Showing posts with label user. Show all posts
Showing posts with label user. Show all posts

Friday, March 30, 2012

is it possible to put the raiseerror in a text file or show it to the user after its been

I am in process of building a website where the user can upload files and then those files are loaded in to a sql server database. I am using some sprocs to scrub the data and then insert them into the production database.. And in my sprpc before and after updating or inserting a record or scrubing... i am returning the count by raising an error. or returning the rownumber where the error occured.. is there any way i can get the raise error part or whatever error i get while scrubing the data and relay it back to the user in a user freindly way or in a text file... or the best thing is can i open smalll window where i can show them what processing is goin on and alert them if there are any errors...

Any help will be appreciated.

Regards

Karen

Take a look forSqlException.Errors. Any SqlError object has the number of error and another informations.

PS.: To another databases, take a look forOleDbException.Errors.

|||

Hi Karenros,

Based on my understanding, you want to use Raiserror to generate an error message and pass it to the client user. Client user may get an alerting message or write it to a text file when getting the error message. If I've misunderstood you ,please feel free to tell me, thanks.

You can put your sqlcommand in a try block and in your catch block, write sqlconnection.errors.message to a text file. Please remember do not assign the severity value of your error message more than 19, or else it maybe cause terminate your connection. Sample code is like the following:

 try { con.Open(); cmd.ExecuteNonQuery(); }catch (SqlException ex) {using(StreamWriter sw=new StreamWriter("your text log file path here")) {foreach (SqlError errin ex.Errors) sw.WriteLine(err.Message+"\n"); } }
Hope my suggestion helps
|||

Chen,

Thanks for your answer. yeah and thats exactly that i wanted to do... so that user would know if the import process was successful or not...

I have tried using sqlexception before with no luck.. may be i didnt import the right header files in order for that work and i have also seen on msdn that we need a sqlinfomessage class or something like to do it.. Pls correct me if i am wrong...

anyways i am gonna give it a try and will let you know...

Regards

Karen

|||

Below is an example of how you can use the InfoMessage event handler:

First you'll have to create an event handler for this event like below:

con.Open();
con.InfoMessage +=new SqlInfoMessageEventHandler(con_InfoMessage);// here i've registered for the event
... set up the command object
cmd.NotificationAutoEnlist =true;
cmd.ExecuteNonQuery();

Then you can go on and write any code you want in that event handler method.

private void con_InfoMessage(object sender, SqlInfoMessageEventArgs e)
{
// your file writing code goes here. The eventArgs e holds errors, messages, source etc.
// you can just use e.ToString() and everything is there for you.
}

Hope this will help.

|||

Hi Karenros,

I've tested the sqlexception code on my local machine and it does work fine. So, maybe you have made some mistakes somewhere else.

However, I think you can also trydhimant 's solution. That's really a good method to solve your problem. thanks

Is it possible to prevent user to edit parameters in adress bar?

I have reports in report server which are accessed by url access with parameters.

When the report is generated the whole url string is displayed in the adress bar with parameters. Is there any way to prevent the user to change the parameter value?

Any ider whould be very appreciated!

You could use a html form and use POST instead of using GET via the url.

See http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=301748&SiteID=1

Wednesday, March 28, 2012

is it possible to merge 2 columns into 1 in SQL server

Hi..

is it possible to merge 2 columns into 1 to hold data like this... When the user imports the file in particular file they will be

ACT_ID1 Tot_ACT1 ACT_ID2 TOT_ACT2 ..... until 15

BB 1245.45 CT some amount ....

The 2 letter character may change prob for each file.. at leat i know of somethem may change

So while i transfer the data to the production database can is it possible to do some thing like

COL1 BB 1245.45

COL2 CT 12456.12 etc..

Any help will be appreciated.

Regards

Karen

Hi Karen

You could try two inserts. Do the first one on column 1 and 2 and then do the second one on 3 and 4 in the same destination table. Put them in a stored proc that gets called on the import. You may also want to add a column that identifies which set of columns they are from.

|||

Charles,

Thanks for your answer... I am getting these acronymns from another dbf file which the user imports... so does it makes sense to create a table called acronymns (may change the name later) and have the following fields..

AcryID(int identity) Name Description

so when i am importing the information into the production database i can reference the acronymn from this table by inner joining it and then insert the data into the production database... like the way you suggested...

Is this approach good or would it slow down things...

Any other suggestions are welcome too.

Regards

Karen

|||

Anything you can do to normalize the data is a good thing, in terms of performance, maintenance and scalability.

|||

so do u think the approach is good or bad ?

|||

Yes. Here's an article about normalization:

http://en.wikipedia.org/wiki/Database_normalization

Is it possible to logon to SQL Server as a different Windows user?

I'd like to stay logged on to windows as myself, a network user, but
logon to a remote SQL Server on the network as a different network
windows user who has an account on SQL Server with more privileges. Is
this possible? Say I'm logged on as network user mynetwork\myself and
I want to keep that open but logon to SQL Server as network user
mynetwork\otheruser.fumanchu wrote:
> I'd like to stay logged on to windows as myself, a network user, but
> logon to a remote SQL Server on the network as a different network
> windows user who has an account on SQL Server with more privileges. Is
> this possible? Say I'm logged on as network user mynetwork\myself and
> I want to keep that open but logon to SQL Server as network user
> mynetwork\otheruser.
If you have the Run As service running on your Windows 2000/XP client,
you can run an Explorer session as another Windows user and run the
application from that new instance on Explorer. To use teh Run As option
hold down the CTRL key and right-click My Computer on the Desktop.
--
David Gugick
Imceda Software
www.imceda.com

Is it possible to logon to SQL Server as a different Windows user?

I'd like to stay logged on to windows as myself, a network user, but
logon to a remote SQL Server on the network as a different network
windows user who has an account on SQL Server with more privileges. Is
this possible? Say I'm logged on as network user mynetwork\myself and
I want to keep that open but logon to SQL Server as network user
mynetwork\otheruser.
fumanchu wrote:
> I'd like to stay logged on to windows as myself, a network user, but
> logon to a remote SQL Server on the network as a different network
> windows user who has an account on SQL Server with more privileges. Is
> this possible? Say I'm logged on as network user mynetwork\myself and
> I want to keep that open but logon to SQL Server as network user
> mynetwork\otheruser.
If you have the Run As service running on your Windows 2000/XP client,
you can run an Explorer session as another Windows user and run the
application from that new instance on Explorer. To use teh Run As option
hold down the CTRL key and right-click My Computer on the Desktop.
David Gugick
Imceda Software
www.imceda.com

Is it possible to logon to SQL Server as a different Windows user?

I'd like to stay logged on to windows as myself, a network user, but
logon to a remote SQL Server on the network as a different network
windows user who has an account on SQL Server with more privileges. Is
this possible? Say I'm logged on as network user mynetwork\myself and
I want to keep that open but logon to SQL Server as network user
mynetwork\otheruser.fumanchu wrote:
> I'd like to stay logged on to windows as myself, a network user, but
> logon to a remote SQL Server on the network as a different network
> windows user who has an account on SQL Server with more privileges. Is
> this possible? Say I'm logged on as network user mynetwork\myself and
> I want to keep that open but logon to SQL Server as network user
> mynetwork\otheruser.
If you have the Run As service running on your Windows 2000/XP client,
you can run an Explorer session as another Windows user and run the
application from that new instance on Explorer. To use teh Run As option
hold down the CTRL key and right-click My Computer on the Desktop.
David Gugick
Imceda Software
www.imceda.com

Monday, March 26, 2012

Is it possible to hide a field or fields based on User Groups?

RS 2000

I have a report that has a few sensitive fields and would only like to show them to a certain AD group.

Is this possible?
Hi,

sure this is possible through custom .NET code. Implement your own Active Driectory checking class and use that within reporting Services. Based on this class you can make the textbox Visible or Hidden.

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de

Is it possible to grant a login the permission to create and schedule jobs?

I have a user who does not need to have any other server permissions other
than to create and schedule jobs, but I'm going round in circles trying to
figure out if I can actually do this using BOL as a resource. Is it possible
and if so, how?
TIA
Michael MacGregor
Database ArchitectMichael,
Yes it is possible, as long as the user is the job owner. The BOL says that
sp_add_job is public, which means that anyone who is a user of msdb (which
you may not have granted to everyone) should be able to create a job. So
first, the user needs rights to msdb.
*** SQL 2000 - I remember that we needed to do more, as show below, but no
longer remember all the reasons.
You can create a role, such as AgentJobManager and grant specific rights.
Users will (as non-sysadmins) be limited to managing the jobs that they
personally create.
GRANT EXECUTE ON sp_add_category TO AgentJobManager
GRANT EXECUTE ON sp_add_job TO AgentJobManager
GRANT EXECUTE ON sp_add_jobschedule TO AgentJobManager
GRANT EXECUTE ON sp_add_jobstep TO AgentJobManager
GRANT EXECUTE ON sp_delete_category TO AgentJobManager
GRANT EXECUTE ON sp_delete_job TO AgentJobManager
GRANT EXECUTE ON sp_delete_jobschedule TO AgentJobManager
GRANT EXECUTE ON sp_delete_jobstep TO AgentJobManager
GRANT EXECUTE ON sp_post_msx_operation TO AgentJobManager
GRANT EXECUTE ON sp_update_category TO AgentJobManager
GRANT EXECUTE ON sp_update_job TO AgentJobManager
GRANT EXECUTE ON sp_update_jobschedule TO AgentJobManager
GRANT EXECUTE ON sp_update_jobstep TO AgentJobManager
GRANT SELECT ON syscategories TO AgentJobManager
GRANT SELECT ON sysjobsTO AgentJobManager
GRANT SELECT ON sysjobserversTO AgentJobManager
Then make the necessary users member of the AgentJobManager role.
*** SQL 2005
Make the users members of one of the following roles, according to what
rights you want them to have:
SQLAgentOperatorRole
SQLAgentReaderRole
SQLAgentUserRole
RLF
"Michael MacGregor" <nospam@.nospam.com> wrote in message
news:uxaKhSVyHHA.4004@.TK2MSFTNGP05.phx.gbl...

>I have a user who does not need to have any other server permissions other
>than to create and schedule jobs, but I'm going round in circles trying to
>figure out if I can actually do this using BOL as a resource. Is it
>possible and if so, how?
> TIA
> Michael MacGregor
> Database Architect
>|||Thanks Russell. It would have probably taken me a long time to figure that
out.
MTM

Friday, March 23, 2012

Is it possible to determine which user created a table?

I've come across a table in one of my databases that I don't remember
creating. Is it possible to tell which user created this table?Hello,
sp_help <tableName>
If the user create the table with DBO schema then the owner will be DBO and
it would be tough for you to identify the user who created the table.
Thanks
Hari
"Danielle" <wxbuff@.aol.com> wrote in message
news:1176065707.471519.177860@.p77g2000hsh.googlegroups.com...
> I've come across a table in one of my databases that I don't remember
> creating. Is it possible to tell which user created this table?
>|||Thanks Hari -
You were right... DBO is the owner. Not much to go on I'm afraid, but
that is a handy SP. Thanks for the tip.
Danielle|||On Apr 9, 2:00 pm, "Danielle" <wxb...@.aol.com> wrote:
> Thanks Hari -
> You were right... DBO is the owner. Not much to go on I'm afraid, but
> that is a handy SP. Thanks for the tip.
> Danielle
If you are on SQL 2005 you can use DDL triggers. I do this to track
all schema changes. You can look in "DDL Triggers" in BOL. I know when
my developers change tables, procs, views, fields etc.
Kristina|||On Apr 8, 4:55 pm, "Danielle" <wxb...@.aol.com> wrote:
> I've come across a table in one of my databases that I don't remember
> creating. Is it possible to tell which user created this table?
You can also use the information_schema.tables view
run this but change 'YourTableName' to the actual table name
select table_schema as ObjectOwner,table_name,*
from information_schema.tables
where table_name ='YourTableName'
Denis the SQL Menace
http://sqlservercode.blogspot.com/sql

Is it possible to determine which user created a table?

I've come across a table in one of my databases that I don't remember
creating. Is it possible to tell which user created this table?Hello,
sp_help <tableName>
If the user create the table with DBO schema then the owner will be DBO and
it would be tough for you to identify the user who created the table.
Thanks
Hari
"Danielle" <wxbuff@.aol.com> wrote in message
news:1176065707.471519.177860@.p77g2000hsh.googlegroups.com...
> I've come across a table in one of my databases that I don't remember
> creating. Is it possible to tell which user created this table?
>|||Thanks Hari -
You were right... DBO is the owner. Not much to go on I'm afraid, but
that is a handy SP. Thanks for the tip.
Danielle|||On Apr 9, 2:00 pm, "Danielle" <wxb...@.aol.com> wrote:
> Thanks Hari -
> You were right... DBO is the owner. Not much to go on I'm afraid, but
> that is a handy SP. Thanks for the tip.
> Danielle
If you are on SQL 2005 you can use DDL triggers. I do this to track
all schema changes. You can look in "DDL Triggers" in BOL. I know when
my developers change tables, procs, views, fields etc.
Kristina|||On Apr 8, 4:55 pm, "Danielle" <wxb...@.aol.com> wrote:
> I've come across a table in one of my databases that I don't remember
> creating. Is it possible to tell which user created this table?
You can also use the information_schema.tables view
run this but change 'YourTableName' to the actual table name
select table_schema as ObjectOwner,table_name,*
from information_schema.tables
where table_name ='YourTableName'
Denis the SQL Menace
http://sqlservercode.blogspot.com/

Is it possible to determine which user created a table?

I've come across a table in one of my databases that I don't remember
creating. Is it possible to tell which user created this table?
Hello,
sp_help <tableName>
If the user create the table with DBO schema then the owner will be DBO and
it would be tough for you to identify the user who created the table.
Thanks
Hari
"Danielle" <wxbuff@.aol.com> wrote in message
news:1176065707.471519.177860@.p77g2000hsh.googlegr oups.com...
> I've come across a table in one of my databases that I don't remember
> creating. Is it possible to tell which user created this table?
>
|||Thanks Hari -
You were right... DBO is the owner. Not much to go on I'm afraid, but
that is a handy SP. Thanks for the tip.
Danielle
|||On Apr 9, 2:00 pm, "Danielle" <wxb...@.aol.com> wrote:
> Thanks Hari -
> You were right... DBO is the owner. Not much to go on I'm afraid, but
> that is a handy SP. Thanks for the tip.
> Danielle
If you are on SQL 2005 you can use DDL triggers. I do this to track
all schema changes. You can look in "DDL Triggers" in BOL. I know when
my developers change tables, procs, views, fields etc.
Kristina
|||On Apr 8, 4:55 pm, "Danielle" <wxb...@.aol.com> wrote:
> I've come across a table in one of my databases that I don't remember
> creating. Is it possible to tell which user created this table?
You can also use the information_schema.tables view
run this but change 'YourTableName' to the actual table name
select table_schema as ObjectOwner,table_name,*
from information_schema.tables
where table_name ='YourTableName'
Denis the SQL Menace
http://sqlservercode.blogspot.com/

Is it possible to customize the Report Manager user interface?

I would like to add my own logos, fonts and layouts so the Report Manager
user interfaces better fits in with our site. Is this possible by editing
HTML templates or style sheets?
Thanks,
SteveTry to get your hands on Hitchhiker's guide to SQL server Reporting services
book , it will show you the lot i.e how to customise the RS interface etc...
alternatively visit http://www.sqlreportingservices.net
hope it helps!
"Stephen Walch" wrote:
> I would like to add my own logos, fonts and layouts so the Report Manager
> user interfaces better fits in with our site. Is this possible by editing
> HTML templates or style sheets?
> Thanks,
> Steve
>
>|||Customizing the Report Manager user interface is not
supported although The file \Microsoft SQL
Server\MSSQL\ReportingServices\ReportManager\Styles\Repor
tingServices.css allows some changes but this was not a
design goal it can't be guaranteed to be easy to
understand and not everything was exposed.
If you want to change the reporting services site name
displayed in Report Manager you can modify that on
Report Manager's site settings page.
Sincerely,
William Wang
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from your issue.
This posting is provided "AS IS" with no warranties, and
confers no rights.
--
>From: "Stephen Walch" <swalch@.online.nospam>
>Subject: Is it possible to customize the Report Manager
user interface?
>Date: Sun, 27 Feb 2005 17:41:58 -0500
>Lines: 9
>X-Priority: 3
>X-MSMail-Priority: Normal
>X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
>X-RFC2646: Format=Flowed; Original
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
>Message-ID: <#Bk3N2RHFHA.3928@.TK2MSFTNGP09.phx.gbl>
>Newsgroups: microsoft.public.sqlserver.reportingsvcs
>NNTP-Posting-Host: 69-164-66-20.lndnnh.adelphia.net
69.164.66.20
>Path:
TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.
phx.gbl!TK2MSFTNGP09.phx.gbl
>Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.sqlserver.reportingsvcs:44052
>X-Tomcat-NG: microsoft.public.sqlserver.reportingsvcs
>I would like to add my own logos, fonts and layouts so
the Report Manager
>user interfaces better fits in with our site. Is this
possible by editing
>HTML templates or style sheets?
>Thanks,
>Steve
>
>|||You can write your own. Start with the ReportViewer sample included with
RS.
--
Cheers,
'(' Jeff A. Stucker
\
Business Intelligence
www.criadvantage.com
---
"Stephen Walch" <swalch@.online.nospam> wrote in message
news:%23Bk3N2RHFHA.3928@.TK2MSFTNGP09.phx.gbl...
>I would like to add my own logos, fonts and layouts so the Report Manager
> user interfaces better fits in with our site. Is this possible by editing
> HTML templates or style sheets?
> Thanks,
> Steve
>

Wednesday, March 21, 2012

Is it possible to customize the look of the parameters form?

Hi all...
When a report is viewed in web browser, a parameters form appear at the top
of the screen so that user can enter parameters and then press View Report.
Is it possible to display a title before that form? or to customize the
colors and fonts for that form?
Thanks
JaimeHave the SAME question!! =:)
"Jaime Stuardo" wrote:
> Hi all...
> When a report is viewed in web browser, a parameters form appear at the top
> of the screen so that user can enter parameters and then press View Report.
> Is it possible to display a title before that form? or to customize the
> colors and fonts for that form?
> Thanks
> Jaime|||You can adjust the colours of the parameters form by changing the
htmlviewer.css stylesheet. Supposedly if you have installed the hot fix for
sp2 then you should find a proptery called htmlviewrstylesheet which you can
set to any style sheet you have created to be th edefault for all reports but
I havent found this.
so in the url of the reports when they are called from another web page I
use the command rc:Stylesheet=stylesheetname
"=:)" wrote:
> Have the SAME question!! =:)
> "Jaime Stuardo" wrote:
> > Hi all...
> >
> > When a report is viewed in web browser, a parameters form appear at the top
> > of the screen so that user can enter parameters and then press View Report.
> >
> > Is it possible to display a title before that form? or to customize the
> > colors and fonts for that form?
> >
> > Thanks
> > Jaime|||IS there a way of hiding the parameters completely as I dont want to
allow the users to change the parameters.
Sorry for the dumb question but this is my 2nd day on reporting
services and i'm trying to get to grips with it very quickly|||Hi Jim,
&rc:Parameters=False is an option.
(have a look here:
http://weblogs.asp.net/mhawley/archive/2004/11/17/259178.aspx for more).
HTH,
Ed Richard
"JimW13UK" <jimw13uk@.uku.co.uk> wrote in message
news:1120725823.751966.67920@.g14g2000cwa.googlegroups.com...
> IS there a way of hiding the parameters completely as I dont want to
> allow the users to change the parameters.
> Sorry for the dumb question but this is my 2nd day on reporting
> services and i'm trying to get to grips with it very quickly
>|||Thanks Ed. The link you posted has answered my question. I can program my
custom parameter form using either VB.NET or C# and using ReportViewer
control to actually show the report.
Jaime
"Ed Richard" wrote:
> Hi Jim,
> &rc:Parameters=False is an option.
> (have a look here:
> http://weblogs.asp.net/mhawley/archive/2004/11/17/259178.aspx for more).
> HTH,
> Ed Richard
> "JimW13UK" <jimw13uk@.uku.co.uk> wrote in message
> news:1120725823.751966.67920@.g14g2000cwa.googlegroups.com...
> > IS there a way of hiding the parameters completely as I dont want to
> > allow the users to change the parameters.
> > Sorry for the dumb question but this is my 2nd day on reporting
> > services and i'm trying to get to grips with it very quickly
> >
>
>

Is it possible to create dynamic reports using reporting services

I have a requirement to create dynamic reports for my client.

once i create these reports then the user will choose columns of there choice.

so the columns may belong to multiple tables.

Now the report should get generated with the layout etc. is it possible.

since our project is totally on the webserver(webbased.)

please if you can provide me with any links with dynamic report creation wizards.

and also we only use Stored procedures via database.

which is best is writing the entire queries right behind the layouit or calling the entire logic via Stored procedure. i am a bit confused. this is my first project working on reports itself.

Thank you all for the helpful information.

Sounds like you need to generate the report definitions programatically. The RDL Object Model code sample in this download should help.sql

Is it possible to create a custom SQL session function/variable

To avoid having to pass this user specific ID via a parameter in the stored
procedure, is it possible to create your own function like (like
suser_sid()) or variable (like @.@.SPID) ?
This value would be passed from a Web Service (asp.net 2.0) in the
connection string or something and could be referred to anywhere in the SQL
code (SQL 2005).
Has anyone got a better solution than a SP parameter ?Take a look at CONTEXT_INFO in the Books Online. This allows you to store
up to 128 bytes of binary info that can be used anywhere in the session.
--
Hope this helps.
Dan Guzman
SQL Server MVP
"GMG" <gmgsoftware@.nospam.net.au> wrote in message
news:uI04I9duHHA.4440@.TK2MSFTNGP06.phx.gbl...
> To avoid having to pass this user specific ID via a parameter in the
> stored
> procedure, is it possible to create your own function like (like
> suser_sid()) or variable (like @.@.SPID) ?
> This value would be passed from a Web Service (asp.net 2.0) in the
> connection string or something and could be referred to anywhere in the
> SQL
> code (SQL 2005).
> Has anyone got a better solution than a SP parameter ?
>

Is it possible to create a custom SQL session function/variable

To avoid having to pass this user specific ID via a parameter in the stored
procedure, is it possible to create your own function like (like
suser_sid()) or variable (like @.@.SPID) ?
This value would be passed from a Web Service (asp.net 2.0) in the
connection string or something and could be referred to anywhere in the SQL
code (SQL 2005).
Has anyone got a better solution than a SP parameter ?Take a look at CONTEXT_INFO in the Books Online. This allows you to store
up to 128 bytes of binary info that can be used anywhere in the session.
Hope this helps.
Dan Guzman
SQL Server MVP
"GMG" <gmgsoftware@.nospam.net.au> wrote in message
news:uI04I9duHHA.4440@.TK2MSFTNGP06.phx.gbl...
> To avoid having to pass this user specific ID via a parameter in the
> stored
> procedure, is it possible to create your own function like (like
> suser_sid()) or variable (like @.@.SPID) ?
> This value would be passed from a Web Service (asp.net 2.0) in the
> connection string or something and could be referred to anywhere in the
> SQL
> code (SQL 2005).
> Has anyone got a better solution than a SP parameter ?
>sql

Is it possible to create a custom SQL session function/variable

To avoid having to pass this user specific ID via a parameter in the stored
procedure, is it possible to create your own function like (like
suser_sid()) or variable (like @.@.SPID) ?
This value would be passed from a Web Service (asp.net 2.0) in the
connection string or something and could be referred to anywhere in the SQL
code (SQL 2005).
Has anyone got a better solution than a SP parameter ?Asked and answered in .programming. Please refrain from multiposting.
Adam Machanic
SQL Server MVP
Author, "Expert SQL Server 2005 Development"
http://www.apress.com/book/bookDisplay.html?bID=10220
"GMG" <gmgsoftware@.nospam.net.au> wrote in message
news:%23cNc2ceuHHA.3376@.TK2MSFTNGP04.phx.gbl...
> To avoid having to pass this user specific ID via a parameter in the
> stored
> procedure, is it possible to create your own function like (like
> suser_sid()) or variable (like @.@.SPID) ?
> This value would be passed from a Web Service (asp.net 2.0) in the
> connection string or something and could be referred to anywhere in the
> SQL
> code (SQL 2005).
> Has anyone got a better solution than a SP parameter ?
>|||Take a look at SET CONTEXT_INFO in the Books Online. That allows you to set
a value for the connection that is accessible anywhere in the session with
the CONTEXT_INFO function. Since the value is binary, you'll need to
convert as needed.
Hope this helps.
Dan Guzman
SQL Server MVP
"GMG" <gmgsoftware@.nospam.net.au> wrote in message
news:%23cNc2ceuHHA.3376@.TK2MSFTNGP04.phx.gbl...
> To avoid having to pass this user specific ID via a parameter in the
> stored
> procedure, is it possible to create your own function like (like
> suser_sid()) or variable (like @.@.SPID) ?
> This value would be passed from a Web Service (asp.net 2.0) in the
> connection string or something and could be referred to anywhere in the
> SQL
> code (SQL 2005).
> Has anyone got a better solution than a SP parameter ?
>

is it possible to connect to SQL Express without network?

I have notebook, client server application and sql express sp2 on this notebook.

Also, I know domain user login/password,

but I don't know any local user name/password

and I don't know any sql server user name/password.

Domain user is not a local administrator on this notebook.

When notebook connected to the office LAN I am working good with my app-> my sql express as a domain/user.

I'd like to work at home too. I can logon to the system (XP SP2) using domain account when notebook has no network connection. (probably OS caches something)

Is it possible to work with sql express using domain login when no network connection?

PS. old version of this software used MSDE 2000 and it was possible(!).

Thank you.

Yes. SQL Server will still work the same as when you are connected to the office LAN.

Since you log on with your domain credentials (they are cachd on the laptop), the same credentials are used to gain entry to SQL Server.

|||

Arnie Rowland wrote:

Yes. SQL Server will still work the same as when you are connected to the office LAN.

Since you log on with your domain credentials (they are cachd on the laptop), the same credentials are used to gain entry to SQL Server.

Ok, thank you.

I did experiment on 2 workstations.

On one machine ist working good, but on the second machine (no netowrk connection) when I tried to connect to the sql server I have a problem:

SSMS is ocnnecting ok

Application gives me message: cannot generate SSPI context.

What can it be? ...

Thank you

|||

Check these souces:

Error -Cannot generate SSPI context
http://support.microsoft.com/Default.aspx?id=811889
http://support.microsoft.com/kb/827422/en-us
http://support.microsoft.com/kb/843248/en-us
http://support.microsoft.com/kb/269541/en-us
http://support.microsoft.com/kb/267588/en-us
http://support.microsoft.com/kb/814401/en-us
http://support.microsoft.com/kb/818173/en-us

sql

Monday, March 19, 2012

Is it possible to change the data type during an sql update statement?

Hello,

I have a SQL update statement that updates some user names, however, the user names exceed the length of the data type. Currently, for the column username the data type is set to nvarchar (8).

How can I change that to nvarchar(10) in a SQL Update statement?

Thanks in advance.

You can't put in more data than there is space to store it. If the column holds 8 characters, then you cannot put 10 characters in that same space.

You would need to change the table definition to increase the space allocated for the UserNames.

|||

Thanks for the reply...

I figured that would be the case, but what I need to do is change the data type to 10 before I can update the user names. I also tried using Alter table:

ALTER TABLE table_name
MODIFY column_name column_type;

For some reason, SQL Express did not like the MODIFY function...

Thanks in advance...

|||

Refer to Books Online, Topic: "Alter Table"

Modify is not a T-SQL keyword. You need to use ALTER.

Code Snippet


ALTER TABLE MyTable
ALTER COLUMN MyColumn varchar(10)

You might wish to consider bumping it up a bit more -just in case you later find more is required.

Here is Books Online for SQL Server Express:

SQL Server 2005 Express Books Online Express Edition
http://msdn2.microsoft.com/en-us/library/ms165706.aspx
http://www.microsoft.com/downloads/details.aspx?FamilyId=BE6A2C5D-00DF-4220-B133-29C1E0B6585F

|||

That worked!

I greatly appreciate your response, and for providing me with the SQL links.

Thanks Arnie!

|||It does not work if MyColumn has a relationship with other table. In that case how can I do that? thanks|||

First, remove (or DROP) the PK-FK relationship,

ALTER the column,

then re-establish the relationship.

Monday, March 12, 2012

Is it possible or Is it too much ?

Hi,
This is what i want to do. Is it possible ?
I have a report1 with a textbox button - and a table with 10 rows. when the
user clicks on the textbox button - it should open another report - report2 -
IN ANOTHER BROWSER. report2 takes filter values and has a close button - when
close button is clicked it has to close and come back to REPORT1 with data
passed to table on report1 .
Is it too much ?
RPTake a look at
http://www.microsoft.com/technet/community/newsgroups/dgbrowser/en-us/default.mspx?dg=microsoft.public.sqlserver.reportingsvcs&mid=fcfb2f99-9acf-4374-b939-42811f321d66
It's not a complete solution (you can't return to you first window), I think
that is also possible because the window.open method returns a pointer to the
window. So if you could store that in a global variable of some custom code,
I presume you coukd return to the origanl window. I'm not good enough with
VB.Net to pull that off. I hope somebody can tell me how to do it.
Hope this helps
"RP" wrote:
> Hi,
> This is what i want to do. Is it possible ?
> I have a report1 with a textbox button - and a table with 10 rows. when the
> user clicks on the textbox button - it should open another report - report2 -
> IN ANOTHER BROWSER. report2 takes filter values and has a close button - when
> close button is clicked it has to close and come back to REPORT1 with data
> passed to table on report1 .
> Is it too much ?
> RP