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

Thursday, March 29, 2012

credentials of the user datasource

Hi,

I'd like to programme the execution of a report through the execution property option. However, when I try to do it a message error appears related to credentials of the datasource.

The present action is impossible to complete, because the credentials of the user datasource needed to execute this report are not stored on report server database.

I've tried all possible combinations.

Any idea?

Thanks.

Please set user name and password of the user datasource

following is the sample code to set it.

Microsoft.Reporting.WebForms.DataSourceCredentials[] crd = new Microsoft.Reporting.WebForms.DataSourceCredentials[1];

crd[0] = new Microsoft.Reporting.WebForms.DataSourceCredentials();

crd[0].Name = "DatasourceName";

crd[0].UserId = User;

crd[0].Password = Pwd;

ReportViewer.ServerReport.SetDataSourceCredentials(crd);

If you are using multiple data sources you need to set credentials for each datasource..

please set datasource credentials after setting report and parameter of the report to report viewer..

|||

By "programme the execution of a report through the execution property option" you don't by any chance mean "I want to set up a snapshot or scheduled report through the Executioin panel of the Properties tab of the Report Manager"?

If this is what you mean, then the message means exactly what it says: the datasource has to have its credentials stored with it (whether it is a shared datasource or one embedded in the report).

If the datasource is set up to run with the credentials of the logged-in user, then it can't be queried when there is no logged-in user (such as when you want a snapshot to execute). Doesn't that make sense?

So... how is the data set up for your report? And with what type(s) of credentials is it accessed?

>L<

Credentials not being passed with remote access

I cannot remotely access SQL Server 2005 with Windows Authentication with a
specific login (I get the error 18452 "this user is not associated with a
trusted login.."). I ran a trace with the profiler and it shows that no
values are being passed for the login/credentials.
I can login to the server locally just fine with the login.
Windows Authentication works with the same login work against another SQL
Server machine.
What could be specific to the login or the server that would cause the
credentials not to be passed.
--
John Shahan> What could be specific to the login or the server that would cause the
> credentials not to be passed.
This could be caused by a firewall issue with domain controller
communication. I've also seen this problem due to a time sync issue between
the client and servers.
Hope this helps.
Dan Guzman
SQL Server MVP
"jp" <jp@.discussions.microsoft.com> wrote in message
news:4B43E6E3-D0F0-4084-AED0-6D4139DA79CB@.microsoft.com...
>I cannot remotely access SQL Server 2005 with Windows Authentication with a
> specific login (I get the error 18452 "this user is not associated with a
> trusted login.."). I ran a trace with the profiler and it shows that no
> values are being passed for the login/credentials.
> I can login to the server locally just fine with the login.
> Windows Authentication works with the same login work against another SQL
> Server machine.
> What could be specific to the login or the server that would cause the
> credentials not to be passed.
> --
> John Shahan|||Dan, thank you for your response. I have seen you post helpful information
for many people before.
We looked at the time sync yesterday and it is close.
The odd thing is that it is specific to one login. Login "johnx" does not
pass credentials from any machine. My other login "johnz" works from any
machine. Also, no other users are reporting this problem with their login.
That being the case, do you still think it could be a firewall issue and if
so, what would I look for in the firewall configuration?
And again, to make it more frustrating, "johnx" can use Windows
Authentication on another SQL Server on the same domain with no problem.
John Shahan
"Dan Guzman" wrote:

> This could be caused by a firewall issue with domain controller
> communication. I've also seen this problem due to a time sync issue betwe
en
> the client and servers.
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "jp" <jp@.discussions.microsoft.com> wrote in message
> news:4B43E6E3-D0F0-4084-AED0-6D4139DA79CB@.microsoft.com...
>|||> That being the case, do you still think it could be a firewall issue and
> if
> so, what would I look for in the firewall configuration?
If other users can successfully login with Windows authentication from the
same machines that fail with "john", then it's probably not a firewall
issue. Furthermore, since "johnx" can successfully login locally, it
appears "johnx" is setup correctly in SQL Server.
The main difference between local and remote access is the communication
protocol. Local access usually uses LCP but remote access is usually done
via TCP/IP or Named Pipes (as specified by the cliconfg.exe utility). Named
pipes requires the Windows account to have the "access this computer from
the network" right so make sure "johnx" has the right (via group membership)
if you are using Named Pipes.
After a successful connection of your working account, you can verify the
connection protocol with:
SELECT net_library
FROM master..sysprocesses
WHERE spid = @.@.spid
If you still can't sort this out, try to connect using SSMS and post the
full error message text here.
Hope this helps.
Dan Guzman
SQL Server MVP
"jp" <jp@.discussions.microsoft.com> wrote in message
news:FC3706EE-CE61-47EE-85A4-DEDDA3A633F6@.microsoft.com...[vbcol=seagreen]
> Dan, thank you for your response. I have seen you post helpful
> information
> for many people before.
> We looked at the time sync yesterday and it is close.
> The odd thing is that it is specific to one login. Login "johnx" does not
> pass credentials from any machine. My other login "johnz" works from any
> machine. Also, no other users are reporting this problem with their
> login.
> That being the case, do you still think it could be a firewall issue and
> if
> so, what would I look for in the firewall configuration?
> And again, to make it more frustrating, "johnx" can use Windows
> Authentication on another SQL Server on the same domain with no problem.
> --
> John Shahan
>
> "Dan Guzman" wrote:
>|||Dan, thanks again for your help. I wanted to share what apparently turned
out to be the solution.
johnx was set up as a local login on sql server. Removing that login
allowed windows authentication to work,
John Shahan
"Dan Guzman" wrote:

> If other users can successfully login with Windows authentication from the
> same machines that fail with "john", then it's probably not a firewall
> issue. Furthermore, since "johnx" can successfully login locally, it
> appears "johnx" is setup correctly in SQL Server.
> The main difference between local and remote access is the communication
> protocol. Local access usually uses LCP but remote access is usually done
> via TCP/IP or Named Pipes (as specified by the cliconfg.exe utility). Nam
ed
> pipes requires the Windows account to have the "access this computer from
> the network" right so make sure "johnx" has the right (via group membershi
p)
> if you are using Named Pipes.
> After a successful connection of your working account, you can verify the
> connection protocol with:
> SELECT net_library
> FROM master..sysprocesses
> WHERE spid = @.@.spid
> If you still can't sort this out, try to connect using SSMS and post the
> full error message text here.
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "jp" <jp@.discussions.microsoft.com> wrote in message
> news:FC3706EE-CE61-47EE-85A4-DEDDA3A633F6@.microsoft.com...
>|||> johnx was set up as a local login on sql server. Removing that login
> allowed windows authentication to work,
I had assumed johnx was a domain user rather than a local Windows account.
I'm glad you got it working.
Dan Guzman
SQL Server MVP
"jp" <jp@.discussions.microsoft.com> wrote in message
news:36AE4208-0F21-4B0C-A735-4F9663FC812C@.microsoft.com...[vbcol=seagreen]
> Dan, thanks again for your help. I wanted to share what apparently turned
> out to be the solution.
> johnx was set up as a local login on sql server. Removing that login
> allowed windows authentication to work,
> --
> John Shahan
>
> "Dan Guzman" wrote:
>

Credentials in Data Sources are getting locked out of SQL

Weird one this....

Created a report. Set up a new datasource. Using credentials securely stored in server. Set up a local user on the SQL Server specifically to reference through this datasource.

Go to reportserver, run the report, and it runs fine. Run it a couple more times, runs fine. Then, all of a sudden, it fails, with the error message

  • The referenced account is currently locked out and may not be logged on to. (Exception from HRESULT: 0x80070775)

    This is very strange. I check the account on SQL, and it's still enabled. As it's not a domain account, it hasn't been disabled on the domain. I'm not even familiar with the phrase 'locked out'. After a bit of checking I find out about maxInvalidPasswordAttempts, whereby ASP 'locks out' accounts after 'n' wrong password attempts.

    Firstly, I'm not entering the password wrong. It's correctly entered, and stored in the report server.

    Secondly, where the heck does RS get off locking out accounts without my permission?

    I have no idea how to unlock these accounts.

    If I go ahead and create another account on the SQL, exactly the same thing happens. I can reproduce this at will. It works the first couple of times, then bang, 'locked out' again.

    Anyone got any ideas on how to modify this behavoir?I am getting the same error, all of a sudden, does anyone have a clue how to fix this?|||I am having the same problem. Does anyone know if this is a SP2 problem? Please help!

    |||Hi
    How did you create a user to access the database and this user is not a domain user? If this user is not a sql login user then the OS will lock ou the user and thus the dB lockout. If the user is a non domain user then the OS is trying netuse the account and this will definately lock it out.

    gatharia|||

    |||

    I've solved part of my troubles. I had set up a shared schedule and accidentally was using the default recurrance pattern to start every 10 minutes. This can happen very easily, as when you go to test something you might want to run it once. So... you create a new shared schedule (so you don't end up running everything on your production shared schedule). I don't know why the default is set to this recurrance pattern instead of once. Anyway... I was having the same problem as Sam Loud, but it was not caused by what I was currently doing. It was caused by this recurring "thing" that was running with the wrong password.

    Another "Thing" that caused this problem is when I tried to use shared data sources. As far as I can tell, you cannot use shared data sources when trying to use subscriptions to fileshare. I think this is a bug with reportserver. The first time it runs, it will run successfully. The second time it runs, you will get the RSLogonFailed. I don't know any way around this problem other than to just not use shared data sources.

    The other thing that has caused me problems is that when I modify a report and deploy it, make sure not to overwrite the datasource (note: this is the default setting in IIS). If you overwrite the datasource, then the userid and password that you set up on the datasource on the server gets wiped out and everything bombs out on logon and again you have a lockout situation.

    I am still having some lockouts and still working on this problem. If anyone else can let me know what their experiences are that would be very helpful. I am using subscriptions to fileshare with about 200 reports running on various schedules. Thanks!

  • Credentials in Data Sources are getting locked out of SQL

    Weird one this....

    Created a report. Set up a new datasource. Using credentials securely stored in server. Set up a local user on the SQL Server specifically to reference through this datasource.

    Go to reportserver, run the report, and it runs fine. Run it a couple more times, runs fine. Then, all of a sudden, it fails, with the error message

  • The referenced account is currently locked out and may not be logged on to. (Exception from HRESULT: 0x80070775) This is very strange. I check the account on SQL, and it's still enabled. As it's not a domain account, it hasn't been disabled on the domain. I'm not even familiar with the phrase 'locked out'. After a bit of checking I find out about maxInvalidPasswordAttempts, whereby ASP 'locks out' accounts after 'n' wrong password attempts.

    Firstly, I'm not entering the password wrong. It's correctly entered, and stored in the report server.

    Secondly, where the heck does RS get off locking out accounts without my permission?

    I have no idea how to unlock these accounts.

    If I go ahead and create another account on the SQL, exactly the same thing happens. I can reproduce this at will. It works the first couple of times, then bang, 'locked out' again.

    Anyone got any ideas on how to modify this behavoir?
    I am getting the same error, all of a sudden, does anyone have a clue how to fix this?|||I am having the same problem. Does anyone know if this is a SP2 problem? Please help!|||Hi
    How did you create a user to access the database and this user is not a domain user? If this user is not a sql login user then the OS will lock ou the user and thus the dB lockout. If the user is a non domain user then the OS is trying netuse the account and this will definately lock it out.

    gatharia
    |||

    I've solved part of my troubles. I had set up a shared schedule and accidentally was using the default recurrance pattern to start every 10 minutes. This can happen very easily, as when you go to test something you might want to run it once. So... you create a new shared schedule (so you don't end up running everything on your production shared schedule). I don't know why the default is set to this recurrance pattern instead of once. Anyway... I was having the same problem as Sam Loud, but it was not caused by what I was currently doing. It was caused by this recurring "thing" that was running with the wrong password.

    Another "Thing" that caused this problem is when I tried to use shared data sources. As far as I can tell, you cannot use shared data sources when trying to use subscriptions to fileshare. I think this is a bug with reportserver. The first time it runs, it will run successfully. The second time it runs, you will get the RSLogonFailed. I don't know any way around this problem other than to just not use shared data sources.

    The other thing that has caused me problems is that when I modify a report and deploy it, make sure not to overwrite the datasource (note: this is the default setting in IIS). If you overwrite the datasource, then the userid and password that you set up on the datasource on the server gets wiped out and everything bombs out on logon and again you have a lockout situation.

    I am still having some lockouts and still working on this problem. If anyone else can let me know what their experiences are that would be very helpful. I am using subscriptions to fileshare with about 200 reports running on various schedules. Thanks!

    |||

    The final (and most difficult to resolve) problem that was causing the "logon Failed" and then account lockout problem(s) was related to the windows account that expired (it was set up to expire in 90 days). Since I used this userid when setting up my report subscriptions, all of my subscriptions failed with invalid login and then the account was locked out. When the account userid was reactivated in WINDOWS with the same password, still all of the subscriptions failed on login. This was very frustrating because the main report services account was getting locked every day and nobody could get to the report server and all the report jobs were failing. I tried going into each report subscription and retyping the userid and password (which were valid), but I still got the invalid login. After 3 weeks of frustration and trying different things, I have discovered that what you have to do is 1) go in to the subscription general screen and change the userid and password to something invalid and totally different 2) go out of the subscription general screen (to save your changes) and 3) go back into the subscription general screen and re-type the correct userid and password. This resolved all of my login and lockout problems with the subscriptions and writing to datashare. I hope that this helps anyone else out there who might be struggling with this same issue/problem with reportserver and subscriptions. It is obviously a bug.

  • Credentials in Data Sources are getting locked out of SQL

    Weird one this....

    Created a report. Set up a new datasource. Using credentials securely stored in server. Set up a local user on the SQL Server specifically to reference through this datasource.

    Go to reportserver, run the report, and it runs fine. Run it a couple more times, runs fine. Then, all of a sudden, it fails, with the error message

  • The referenced account is currently locked out and may not be logged on to. (Exception from HRESULT: 0x80070775) This is very strange. I check the account on SQL, and it's still enabled. As it's not a domain account, it hasn't been disabled on the domain. I'm not even familiar with the phrase 'locked out'. After a bit of checking I find out about maxInvalidPasswordAttempts, whereby ASP 'locks out' accounts after 'n' wrong password attempts.

    Firstly, I'm not entering the password wrong. It's correctly entered, and stored in the report server.

    Secondly, where the heck does RS get off locking out accounts without my permission?

    I have no idea how to unlock these accounts.

    If I go ahead and create another account on the SQL, exactly the same thing happens. I can reproduce this at will. It works the first couple of times, then bang, 'locked out' again.

    Anyone got any ideas on how to modify this behavoir?
    I am getting the same error, all of a sudden, does anyone have a clue how to fix this?|||I am having the same problem. Does anyone know if this is a SP2 problem? Please help!|||Hi
    How did you create a user to access the database and this user is not a domain user? If this user is not a sql login user then the OS will lock ou the user and thus the dB lockout. If the user is a non domain user then the OS is trying netuse the account and this will definately lock it out.

    gatharia
    |||

    I've solved part of my troubles. I had set up a shared schedule and accidentally was using the default recurrance pattern to start every 10 minutes. This can happen very easily, as when you go to test something you might want to run it once. So... you create a new shared schedule (so you don't end up running everything on your production shared schedule). I don't know why the default is set to this recurrance pattern instead of once. Anyway... I was having the same problem as Sam Loud, but it was not caused by what I was currently doing. It was caused by this recurring "thing" that was running with the wrong password.

    Another "Thing" that caused this problem is when I tried to use shared data sources. As far as I can tell, you cannot use shared data sources when trying to use subscriptions to fileshare. I think this is a bug with reportserver. The first time it runs, it will run successfully. The second time it runs, you will get the RSLogonFailed. I don't know any way around this problem other than to just not use shared data sources.

    The other thing that has caused me problems is that when I modify a report and deploy it, make sure not to overwrite the datasource (note: this is the default setting in IIS). If you overwrite the datasource, then the userid and password that you set up on the datasource on the server gets wiped out and everything bombs out on logon and again you have a lockout situation.

    I am still having some lockouts and still working on this problem. If anyone else can let me know what their experiences are that would be very helpful. I am using subscriptions to fileshare with about 200 reports running on various schedules. Thanks!

    |||

    The final (and most difficult to resolve) problem that was causing the "logon Failed" and then account lockout problem(s) was related to the windows account that expired (it was set up to expire in 90 days). Since I used this userid when setting up my report subscriptions, all of my subscriptions failed with invalid login and then the account was locked out. When the account userid was reactivated in WINDOWS with the same password, still all of the subscriptions failed on login. This was very frustrating because the main report services account was getting locked every day and nobody could get to the report server and all the report jobs were failing. I tried going into each report subscription and retyping the userid and password (which were valid), but I still got the invalid login. After 3 weeks of frustration and trying different things, I have discovered that what you have to do is 1) go in to the subscription general screen and change the userid and password to something invalid and totally different 2) go out of the subscription general screen (to save your changes) and 3) go back into the subscription general screen and re-type the correct userid and password. This resolved all of my login and lockout problems with the subscriptions and writing to datashare. I hope that this helps anyone else out there who might be struggling with this same issue/problem with reportserver and subscriptions. It is obviously a bug.

  • Credentials in Data Sources are getting locked out of SQL

    Weird one this....

    Created a report. Set up a new datasource. Using credentials securely stored in server. Set up a local user on the SQL Server specifically to reference through this datasource.

    Go to reportserver, run the report, and it runs fine. Run it a couple more times, runs fine. Then, all of a sudden, it fails, with the error message

  • The referenced account is currently locked out and may not be logged on to. (Exception from HRESULT: 0x80070775) This is very strange. I check the account on SQL, and it's still enabled. As it's not a domain account, it hasn't been disabled on the domain. I'm not even familiar with the phrase 'locked out'. After a bit of checking I find out about maxInvalidPasswordAttempts, whereby ASP 'locks out' accounts after 'n' wrong password attempts.

    Firstly, I'm not entering the password wrong. It's correctly entered, and stored in the report server.

    Secondly, where the heck does RS get off locking out accounts without my permission?

    I have no idea how to unlock these accounts.

    If I go ahead and create another account on the SQL, exactly the same thing happens. I can reproduce this at will. It works the first couple of times, then bang, 'locked out' again.

    Anyone got any ideas on how to modify this behavoir?
    I am getting the same error, all of a sudden, does anyone have a clue how to fix this?|||I am having the same problem. Does anyone know if this is a SP2 problem? Please help!|||Hi
    How did you create a user to access the database and this user is not a domain user? If this user is not a sql login user then the OS will lock ou the user and thus the dB lockout. If the user is a non domain user then the OS is trying netuse the account and this will definately lock it out.

    gatharia
    |||

    I've solved part of my troubles. I had set up a shared schedule and accidentally was using the default recurrance pattern to start every 10 minutes. This can happen very easily, as when you go to test something you might want to run it once. So... you create a new shared schedule (so you don't end up running everything on your production shared schedule). I don't know why the default is set to this recurrance pattern instead of once. Anyway... I was having the same problem as Sam Loud, but it was not caused by what I was currently doing. It was caused by this recurring "thing" that was running with the wrong password.

    Another "Thing" that caused this problem is when I tried to use shared data sources. As far as I can tell, you cannot use shared data sources when trying to use subscriptions to fileshare. I think this is a bug with reportserver. The first time it runs, it will run successfully. The second time it runs, you will get the RSLogonFailed. I don't know any way around this problem other than to just not use shared data sources.

    The other thing that has caused me problems is that when I modify a report and deploy it, make sure not to overwrite the datasource (note: this is the default setting in IIS). If you overwrite the datasource, then the userid and password that you set up on the datasource on the server gets wiped out and everything bombs out on logon and again you have a lockout situation.

    I am still having some lockouts and still working on this problem. If anyone else can let me know what their experiences are that would be very helpful. I am using subscriptions to fileshare with about 200 reports running on various schedules. Thanks!

    |||

    The final (and most difficult to resolve) problem that was causing the "logon Failed" and then account lockout problem(s) was related to the windows account that expired (it was set up to expire in 90 days). Since I used this userid when setting up my report subscriptions, all of my subscriptions failed with invalid login and then the account was locked out. When the account userid was reactivated in WINDOWS with the same password, still all of the subscriptions failed on login. This was very frustrating because the main report services account was getting locked every day and nobody could get to the report server and all the report jobs were failing. I tried going into each report subscription and retyping the userid and password (which were valid), but I still got the invalid login. After 3 weeks of frustration and trying different things, I have discovered that what you have to do is 1) go in to the subscription general screen and change the userid and password to something invalid and totally different 2) go out of the subscription general screen (to save your changes) and 3) go back into the subscription general screen and re-type the correct userid and password. This resolved all of my login and lockout problems with the subscriptions and writing to datashare. I hope that this helps anyone else out there who might be struggling with this same issue/problem with reportserver and subscriptions. It is obviously a bug.

  • Credentials in Data Sources are getting locked out of SQL

    Weird one this....

    Created a report. Set up a new datasource. Using credentials securely stored in server. Set up a local user on the SQL Server specifically to reference through this datasource.

    Go to reportserver, run the report, and it runs fine. Run it a couple more times, runs fine. Then, all of a sudden, it fails, with the error message

  • The referenced account is currently locked out and may not be logged on to. (Exception from HRESULT: 0x80070775)

    This is very strange. I check the account on SQL, and it's still enabled. As it's not a domain account, it hasn't been disabled on the domain. I'm not even familiar with the phrase 'locked out'. After a bit of checking I find out about maxInvalidPasswordAttempts, whereby ASP 'locks out' accounts after 'n' wrong password attempts.

    Firstly, I'm not entering the password wrong. It's correctly entered, and stored in the report server.

    Secondly, where the heck does RS get off locking out accounts without my permission?

    I have no idea how to unlock these accounts.

    If I go ahead and create another account on the SQL, exactly the same thing happens. I can reproduce this at will. It works the first couple of times, then bang, 'locked out' again.

    Anyone got any ideas on how to modify this behavoir?
    I am getting the same error, all of a sudden, does anyone have a clue how to fix this?|||I am having the same problem. Does anyone know if this is a SP2 problem? Please help!

    |||Hi
    How did you create a user to access the database and this user is not a domain user? If this user is not a sql login user then the OS will lock ou the user and thus the dB lockout. If the user is a non domain user then the OS is trying netuse the account and this will definately lock it out.

    gatharia
    |||

    |||

    I've solved part of my troubles. I had set up a shared schedule and accidentally was using the default recurrance pattern to start every 10 minutes. This can happen very easily, as when you go to test something you might want to run it once. So... you create a new shared schedule (so you don't end up running everything on your production shared schedule). I don't know why the default is set to this recurrance pattern instead of once. Anyway... I was having the same problem as Sam Loud, but it was not caused by what I was currently doing. It was caused by this recurring "thing" that was running with the wrong password.

    Another "Thing" that caused this problem is when I tried to use shared data sources. As far as I can tell, you cannot use shared data sources when trying to use subscriptions to fileshare. I think this is a bug with reportserver. The first time it runs, it will run successfully. The second time it runs, you will get the RSLogonFailed. I don't know any way around this problem other than to just not use shared data sources.

    The other thing that has caused me problems is that when I modify a report and deploy it, make sure not to overwrite the datasource (note: this is the default setting in IIS). If you overwrite the datasource, then the userid and password that you set up on the datasource on the server gets wiped out and everything bombs out on logon and again you have a lockout situation.

    I am still having some lockouts and still working on this problem. If anyone else can let me know what their experiences are that would be very helpful. I am using subscriptions to fileshare with about 200 reports running on various schedules. Thanks!

    |||

    The final (and most difficult to resolve) problem that was causing the "logon Failed" and then account lockout problem(s) was related to the windows account that expired (it was set up to expire in 90 days). Since I used this userid when setting up my report subscriptions, all of my subscriptions failed with invalid login and then the account was locked out. When the account userid was reactivated in WINDOWS with the same password, still all of the subscriptions failed on login. This was very frustrating because the main report services account was getting locked every day and nobody could get to the report server and all the report jobs were failing. I tried going into each report subscription and retyping the userid and password (which were valid), but I still got the invalid login. After 3 weeks of frustration and trying different things, I have discovered that what you have to do is 1) go in to the subscription general screen and change the userid and password to something invalid and totally different 2) go out of the subscription general screen (to save your changes) and 3) go back into the subscription general screen and re-type the correct userid and password. This resolved all of my login and lockout problems with the subscriptions and writing to datashare. I hope that this helps anyone else out there who might be struggling with this same issue/problem with reportserver and subscriptions. It is obviously a bug.

  • Sunday, March 25, 2012

    Creating user to own schemas?

    I have noticed that some folks create a user to own a schema, with both having the same name (ex: userowner = pfm schema = pfm) and others make dbo the owner for all their schemas. From what I can tell, it doesn't really matter; what does matter is if your database users are granted access to the schema. Since most users only have public rights and dbo has database owner rights, is there any particular reasoning to use one scenario over the other?

    Besides better granularity in your DB application management, one very good reason is to have better isolation between different applications. For example, if all the schemas (and therefore all tables and modules by default) are owned by the same principal (i.e. dbo) it would be very difficult to control access to the data on principals who can create/execute modules (i.e. SPs) as ownership chaining will be available for all tables in the database.

    -Raul Garcia

    SDE/T

    SQL Server Engine

    |||

    Thank you Raul, I agree this does make sense. I just tried to create a user (ampfm) and it failed due to their not being a login named ampfm. However, when I looked at logins, there does not seem to be one for sys or INFORMATION_SCHEMA. How were those users created without also requiring login accounts?

    |||

    Those are builtin-in principals, and they are not intended for any interactive usage. Because they are built-in and not intended for interactive usage the SIDs are set to NULL. I strongly recommend against reusing these built-in principals in any way other than the supported scenarios. Please consult BOL for more information on them.

    If you want to create a user without a login you can use the WITHOUT LOGIN syntax:

    CREATE USER [ampfm] WITHOUT LOGIN

    go

    I hope this information helps.

    -Raul Garcia

    SDE/T

    SQL Server Engine

    |||

    Thanks again Raul. That is exactly what I needed and it worked great!

    creating user procedures in the master database

    I'm running mssql 2005. And any stored procedure I create in the master database gets created as system procedures since recently. I have created procs in the master database as user procs previously. As sp_MS_upd_sysobj_category is not supported in mssql 2005, does anyone know why this is happening.. or how I can rectify it?

    Thanks...

    Moving thread to the DB Engine forum.|||

    It is not a best practice to create user stored procs in master. This SP was undocumented and not subject to the 3 release deprecation policy. I think it went away with the move to the resource database in SQL2K5.

    With that, what is your specific scenario for creating stored procs in master?

    Creating user groups with Forms Authentication

    Hello,
    Is there a way to implement groups with forms authentication? Currently I am
    only able to create users and being able to generate groups would greatly
    help.
    ThanksSearch the below URL for 'forms authentication groups'. I found quite a few
    results:
    http://groups-beta.google.com/group/microsoft.public.sqlserver.reportingsvcs
    --
    Adrian M.
    MCP
    "Sceptical" <skep@.nowhere.com> wrote in message
    news:HrH6e.17208$215.16616@.tornado.rdc-kc.rr.com...
    > Hello,
    > Is there a way to implement groups with forms authentication? Currently I
    > am only able to create users and being able to generate groups would
    > greatly help.
    > Thanks
    >sql

    Creating user from application

    I'm trying to create a user from a powerbuilder application through powerscript.
    I'm trying to create first the login using sp_addlogin
    but I'm getting the following error
    [microsoft][odbc for sql server]the procedure sp_addlogin cannot be executed in transaction.

    Plz does someone know what should I do?CREATE Procedure CreareUser (@.UserName varchar(30), @.UserPass varchar(30), @.DBName varchar(30),@.DreptScriere bit)

    as

    if exists (select * from master.dbo.syslogins where loginname=@.UserName)

    exec sp_dropuser @.UserName
    exec sp_droplogin @.UserName


    if not exists (select * from master.dbo.syslogins where loginname = @.UserName)
    BEGIN

    EXEC sp_addlogin @.UserName, @.UserPass, @.DBName
    EXEC sp_defaultdb @.UserName,@.DBName

    if @.DreptScriere=0
    BEGIN
    EXEC sp_adduser @.UserName,@.UserName,
    'db_denydatawriter'
    EXEC sp_changegroup 'db_owner' ,@.UserName
    EXEC sp_addrolemember 'db_denydatawriter' ,@.UserName
    END
    else
    BEGIN
    EXEC sp_adduser @.UserName,@.UserName,'db_owner'
    END

    EXEC sp_grantdbaccess @.UserName

    END

    creating user defined parameters with input prompts

    Hi,
    i am trying to create a user defined function that return a table and it
    prompts for two inputs
    i have created the functions but how do i get the system to prompt me for
    the inputs via a view ?
    appreciate any advise
    tks & rdgs
    SQL Server cannot prompt a user for anything, as it runs on the server machines, as a service. You
    need to have a client application do that.
    Tibor Karaszi, SQL Server MVP
    http://www.karaszi.com/sqlserver/default.asp
    http://www.solidqualitylearning.com/
    "maxzsim" <maxzsim@.discussions.microsoft.com> wrote in message
    news:8AB52501-7876-4870-ADA1-6DC8BB93785E@.microsoft.com...
    > Hi,
    > i am trying to create a user defined function that return a table and it
    > prompts for two inputs
    > i have created the functions but how do i get the system to prompt me for
    > the inputs via a view ?
    > appreciate any advise
    > tks & rdgs
    |||maxzsim,
    Something like this?
    CREATE FUNCTION myfunc
    @.param1 <datatype>,
    @.param2 <datatype>
    RETURNS TABLE
    AS
    RETURN
    (<your select statement>
    where col1 = @.param1
    and col2 = @.param2)
    GO
    Mark.
    "maxzsim" wrote:

    > Hi,
    > i am trying to create a user defined function that return a table and it
    > prompts for two inputs
    > i have created the functions but how do i get the system to prompt me for
    > the inputs via a view ?
    > appreciate any advise
    > tks & rdgs
    |||Hi ,
    does a view able to prompt the user for the parameters then , i can only
    open a view as a query and where it allowed me to create parameters but it
    seems like there's no way for me to save those changes at all
    is there other way thru using a view ?
    tks & rdgs
    "Tibor Karaszi" wrote:

    > SQL Server cannot prompt a user for anything, as it runs on the server machines, as a service. You
    > need to have a client application do that.
    > --
    > Tibor Karaszi, SQL Server MVP
    > http://www.karaszi.com/sqlserver/default.asp
    > http://www.solidqualitylearning.com/
    >
    > "maxzsim" <maxzsim@.discussions.microsoft.com> wrote in message
    > news:8AB52501-7876-4870-ADA1-6DC8BB93785E@.microsoft.com...
    >
    >
    |||Hi Mark,
    in this case it does not run unless i input some values directly however,
    i wanted to be prompted to enter the 2 parameters
    will a view/stored procedure be able to do that ?
    rdgs
    "Mark Allison" wrote:
    [vbcol=seagreen]
    > maxzsim,
    > Something like this?
    > CREATE FUNCTION myfunc
    > @.param1 <datatype>,
    > @.param2 <datatype>
    > RETURNS TABLE
    > AS
    > RETURN
    > (<your select statement>
    > where col1 = @.param1
    > and col2 = @.param2)
    > GO
    > Mark.
    > "maxzsim" wrote:
    |||gain, prompting a user need to be done in your client applications. You cannot write the whole
    application in SQL only, SQL is only a data retrieval and modification language. The interaction
    with the user need to be done with a client application, written in VB. C#, C++ Delphi Access or
    something like that.
    Tibor Karaszi, SQL Server MVP
    http://www.karaszi.com/sqlserver/default.asp
    http://www.solidqualitylearning.com/
    "maxzsim" <maxzsim@.discussions.microsoft.com> wrote in message
    news:4B01C6CF-392B-499F-8D9F-3824DF3AB2A2@.microsoft.com...[vbcol=seagreen]
    > Hi ,
    > does a view able to prompt the user for the parameters then , i can only
    > open a view as a query and where it allowed me to create parameters but it
    > seems like there's no way for me to save those changes at all
    > is there other way thru using a view ?
    > tks & rdgs
    > "Tibor Karaszi" wrote:
    |||tks Tibor for taking time out to explain to me
    Cheers
    "Tibor Karaszi" wrote:

    > gain, prompting a user need to be done in your client applications. You cannot write the whole
    > application in SQL only, SQL is only a data retrieval and modification language. The interaction
    > with the user need to be done with a client application, written in VB. C#, C++ Delphi Access or
    > something like that.
    > --
    > Tibor Karaszi, SQL Server MVP
    > http://www.karaszi.com/sqlserver/default.asp
    > http://www.solidqualitylearning.com/
    >
    > "maxzsim" <maxzsim@.discussions.microsoft.com> wrote in message
    > news:4B01C6CF-392B-499F-8D9F-3824DF3AB2A2@.microsoft.com...
    >
    >

    creating user defined parameters with input prompts

    Hi,
    i am trying to create a user defined function that return a table and it
    prompts for two inputs
    i have created the functions but how do i get the system to prompt me for
    the inputs via a view ?
    appreciate any advise
    tks & rdgsSQL Server cannot prompt a user for anything, as it runs on the server machines, as a service. You
    need to have a client application do that.
    --
    Tibor Karaszi, SQL Server MVP
    http://www.karaszi.com/sqlserver/default.asp
    http://www.solidqualitylearning.com/
    "maxzsim" <maxzsim@.discussions.microsoft.com> wrote in message
    news:8AB52501-7876-4870-ADA1-6DC8BB93785E@.microsoft.com...
    > Hi,
    > i am trying to create a user defined function that return a table and it
    > prompts for two inputs
    > i have created the functions but how do i get the system to prompt me for
    > the inputs via a view ?
    > appreciate any advise
    > tks & rdgs|||maxzsim,
    Something like this?
    CREATE FUNCTION myfunc
    @.param1 <datatype>,
    @.param2 <datatype>
    RETURNS TABLE
    AS
    RETURN
    (<your select statement>
    where col1 = @.param1
    and col2 = @.param2)
    GO
    Mark.
    "maxzsim" wrote:
    > Hi,
    > i am trying to create a user defined function that return a table and it
    > prompts for two inputs
    > i have created the functions but how do i get the system to prompt me for
    > the inputs via a view ?
    > appreciate any advise
    > tks & rdgs|||Hi ,
    does a view able to prompt the user for the parameters then , i can only
    open a view as a query and where it allowed me to create parameters but it
    seems like there's no way for me to save those changes at all
    is there other way thru using a view ?
    tks & rdgs
    "Tibor Karaszi" wrote:
    > SQL Server cannot prompt a user for anything, as it runs on the server machines, as a service. You
    > need to have a client application do that.
    > --
    > Tibor Karaszi, SQL Server MVP
    > http://www.karaszi.com/sqlserver/default.asp
    > http://www.solidqualitylearning.com/
    >
    > "maxzsim" <maxzsim@.discussions.microsoft.com> wrote in message
    > news:8AB52501-7876-4870-ADA1-6DC8BB93785E@.microsoft.com...
    > > Hi,
    > >
    > > i am trying to create a user defined function that return a table and it
    > > prompts for two inputs
    > >
    > > i have created the functions but how do i get the system to prompt me for
    > > the inputs via a view ?
    > >
    > > appreciate any advise
    > >
    > > tks & rdgs
    >
    >|||Hi Mark,
    in this case it does not run unless i input some values directly however,
    i wanted to be prompted to enter the 2 parameters
    will a view/stored procedure be able to do that ?
    rdgs
    "Mark Allison" wrote:
    > maxzsim,
    > Something like this?
    > CREATE FUNCTION myfunc
    > @.param1 <datatype>,
    > @.param2 <datatype>
    > RETURNS TABLE
    > AS
    > RETURN
    > (<your select statement>
    > where col1 = @.param1
    > and col2 = @.param2)
    > GO
    > Mark.
    > "maxzsim" wrote:
    > > Hi,
    > >
    > > i am trying to create a user defined function that return a table and it
    > > prompts for two inputs
    > >
    > > i have created the functions but how do i get the system to prompt me for
    > > the inputs via a view ?
    > >
    > > appreciate any advise
    > >
    > > tks & rdgs|||gain, prompting a user need to be done in your client applications. You cannot write the whole
    application in SQL only, SQL is only a data retrieval and modification language. The interaction
    with the user need to be done with a client application, written in VB. C#, C++ Delphi Access or
    something like that.
    --
    Tibor Karaszi, SQL Server MVP
    http://www.karaszi.com/sqlserver/default.asp
    http://www.solidqualitylearning.com/
    "maxzsim" <maxzsim@.discussions.microsoft.com> wrote in message
    news:4B01C6CF-392B-499F-8D9F-3824DF3AB2A2@.microsoft.com...
    > Hi ,
    > does a view able to prompt the user for the parameters then , i can only
    > open a view as a query and where it allowed me to create parameters but it
    > seems like there's no way for me to save those changes at all
    > is there other way thru using a view ?
    > tks & rdgs
    > "Tibor Karaszi" wrote:
    >> SQL Server cannot prompt a user for anything, as it runs on the server machines, as a service.
    >> You
    >> need to have a client application do that.
    >> --
    >> Tibor Karaszi, SQL Server MVP
    >> http://www.karaszi.com/sqlserver/default.asp
    >> http://www.solidqualitylearning.com/
    >>
    >> "maxzsim" <maxzsim@.discussions.microsoft.com> wrote in message
    >> news:8AB52501-7876-4870-ADA1-6DC8BB93785E@.microsoft.com...
    >> > Hi,
    >> >
    >> > i am trying to create a user defined function that return a table and it
    >> > prompts for two inputs
    >> >
    >> > i have created the functions but how do i get the system to prompt me for
    >> > the inputs via a view ?
    >> >
    >> > appreciate any advise
    >> >
    >> > tks & rdgs
    >>|||tks Tibor for taking time out to explain to me
    Cheers
    "Tibor Karaszi" wrote:
    > gain, prompting a user need to be done in your client applications. You cannot write the whole
    > application in SQL only, SQL is only a data retrieval and modification language. The interaction
    > with the user need to be done with a client application, written in VB. C#, C++ Delphi Access or
    > something like that.
    > --
    > Tibor Karaszi, SQL Server MVP
    > http://www.karaszi.com/sqlserver/default.asp
    > http://www.solidqualitylearning.com/
    >
    > "maxzsim" <maxzsim@.discussions.microsoft.com> wrote in message
    > news:4B01C6CF-392B-499F-8D9F-3824DF3AB2A2@.microsoft.com...
    > > Hi ,
    > >
    > > does a view able to prompt the user for the parameters then , i can only
    > > open a view as a query and where it allowed me to create parameters but it
    > > seems like there's no way for me to save those changes at all
    > >
    > > is there other way thru using a view ?
    > >
    > > tks & rdgs
    > >
    > > "Tibor Karaszi" wrote:
    > >
    > >> SQL Server cannot prompt a user for anything, as it runs on the server machines, as a service.
    > >> You
    > >> need to have a client application do that.
    > >>
    > >> --
    > >> Tibor Karaszi, SQL Server MVP
    > >> http://www.karaszi.com/sqlserver/default.asp
    > >> http://www.solidqualitylearning.com/
    > >>
    > >>
    > >> "maxzsim" <maxzsim@.discussions.microsoft.com> wrote in message
    > >> news:8AB52501-7876-4870-ADA1-6DC8BB93785E@.microsoft.com...
    > >> > Hi,
    > >> >
    > >> > i am trying to create a user defined function that return a table and it
    > >> > prompts for two inputs
    > >> >
    > >> > i have created the functions but how do i get the system to prompt me for
    > >> > the inputs via a view ?
    > >> >
    > >> > appreciate any advise
    > >> >
    > >> > tks & rdgs
    > >>
    > >>
    > >>
    >
    >

    creating user defined parameters with input prompts

    Hi,
    i am trying to create a user defined function that return a table and it
    prompts for two inputs
    i have created the functions but how do i get the system to prompt me for
    the inputs via a view ?
    appreciate any advise
    tks & rdgsSQL Server cannot prompt a user for anything, as it runs on the server machi
    nes, as a service. You
    need to have a client application do that.
    Tibor Karaszi, SQL Server MVP
    http://www.karaszi.com/sqlserver/default.asp
    http://www.solidqualitylearning.com/
    "maxzsim" <maxzsim@.discussions.microsoft.com> wrote in message
    news:8AB52501-7876-4870-ADA1-6DC8BB93785E@.microsoft.com...
    > Hi,
    > i am trying to create a user defined function that return a table and it
    > prompts for two inputs
    > i have created the functions but how do i get the system to prompt me for
    > the inputs via a view ?
    > appreciate any advise
    > tks & rdgs|||maxzsim,
    Something like this?
    CREATE FUNCTION myfunc
    @.param1 <datatype>,
    @.param2 <datatype>
    RETURNS TABLE
    AS
    RETURN
    (<your select statement>
    where col1 = @.param1
    and col2 = @.param2)
    GO
    Mark.
    "maxzsim" wrote:

    > Hi,
    > i am trying to create a user defined function that return a table and it
    > prompts for two inputs
    > i have created the functions but how do i get the system to prompt me for
    > the inputs via a view ?
    > appreciate any advise
    > tks & rdgs|||Hi ,
    does a view able to prompt the user for the parameters then , i can only
    open a view as a query and where it allowed me to create parameters but it
    seems like there's no way for me to save those changes at all
    is there other way thru using a view ?
    tks & rdgs
    "Tibor Karaszi" wrote:

    > SQL Server cannot prompt a user for anything, as it runs on the server mac
    hines, as a service. You
    > need to have a client application do that.
    > --
    > Tibor Karaszi, SQL Server MVP
    > http://www.karaszi.com/sqlserver/default.asp
    > http://www.solidqualitylearning.com/
    >
    > "maxzsim" <maxzsim@.discussions.microsoft.com> wrote in message
    > news:8AB52501-7876-4870-ADA1-6DC8BB93785E@.microsoft.com...
    >
    >|||Hi Mark,
    in this case it does not run unless i input some values directly however,
    i wanted to be prompted to enter the 2 parameters
    will a view/stored procedure be able to do that ?
    rdgs
    "Mark Allison" wrote:
    [vbcol=seagreen]
    > maxzsim,
    > Something like this?
    > CREATE FUNCTION myfunc
    > @.param1 <datatype>,
    > @.param2 <datatype>
    > RETURNS TABLE
    > AS
    > RETURN
    > (<your select statement>
    > where col1 = @.param1
    > and col2 = @.param2)
    > GO
    > Mark.
    > "maxzsim" wrote:
    >|||gain, prompting a user need to be done in your client applications. You cann
    ot write the whole
    application in SQL only, SQL is only a data retrieval and modification langu
    age. The interaction
    with the user need to be done with a client application, written in VB. C#,
    C++ Delphi Access or
    something like that.
    Tibor Karaszi, SQL Server MVP
    http://www.karaszi.com/sqlserver/default.asp
    http://www.solidqualitylearning.com/
    "maxzsim" <maxzsim@.discussions.microsoft.com> wrote in message
    news:4B01C6CF-392B-499F-8D9F-3824DF3AB2A2@.microsoft.com...[vbcol=seagreen]
    > Hi ,
    > does a view able to prompt the user for the parameters then , i can only
    > open a view as a query and where it allowed me to create parameters but it
    > seems like there's no way for me to save those changes at all
    > is there other way thru using a view ?
    > tks & rdgs
    > "Tibor Karaszi" wrote:
    >|||tks Tibor for taking time out to explain to me
    Cheers
    "Tibor Karaszi" wrote:

    > gain, prompting a user need to be done in your client applications. You ca
    nnot write the whole
    > application in SQL only, SQL is only a data retrieval and modification lan
    guage. The interaction
    > with the user need to be done with a client application, written in VB. C#
    , C++ Delphi Access or
    > something like that.
    > --
    > Tibor Karaszi, SQL Server MVP
    > http://www.karaszi.com/sqlserver/default.asp
    > http://www.solidqualitylearning.com/
    >
    > "maxzsim" <maxzsim@.discussions.microsoft.com> wrote in message
    > news:4B01C6CF-392B-499F-8D9F-3824DF3AB2A2@.microsoft.com...
    >
    >

    Creating User Defined Function for Rolling Calendar Year

    Has anyone ever created a UDF for a rolling calendar year? I would like to
    use that instead of writing this kind of stuff all the time:
    if(datepart(month,@.CurrentDate) =12)
    Begin
    set @.PastDate = '1/1/'+convert(varchar, @.SelectedYear)
    end
    if(datepart(month,@.CurrentDate) !=12)
    Begin
    set @.PastDate = dateadd(month,1,@.PastDate)
    End
    set @.CurrentDate = dateadd(month,1,@.Currentdate)
    if(datepart(day, @.CurrentDate) <= 30)
    Begin
    set @.CurrentDateStep = dateadd(day,1,@.CurrentDate)
    if datepart(month,@.CurrentDateStep) = datepart(month,@.CurrentDate)
    Begin
    set @.currentDate = @.CurrentDateStep
    end
    if datepart(month, @.CurrentDate) = 3
    Begin
    set @.CurrentDate = dateadd(day,2,@.CurrentDate)
    end
    end
    Thanks in advance for any assistance.
    Thanks,
    SPHow about a calendar table?
    http://www.aspfaq.com/2519
    "SP" <SP@.discussions.microsoft.com> wrote in message
    news:8E1056B9-3011-4523-894A-1087FE936B1A@.microsoft.com...
    > Has anyone ever created a UDF for a rolling calendar year? I would like to
    > use that instead of writing this kind of stuff all the time:
    > if(datepart(month,@.CurrentDate) =12)
    > Begin
    > set @.PastDate = '1/1/'+convert(varchar, @.SelectedYear)
    > end
    > if(datepart(month,@.CurrentDate) !=12)
    > Begin
    > set @.PastDate = dateadd(month,1,@.PastDate)
    > End
    > set @.CurrentDate = dateadd(month,1,@.Currentdate)
    > if(datepart(day, @.CurrentDate) <= 30)
    > Begin
    > set @.CurrentDateStep = dateadd(day,1,@.CurrentDate)
    > if datepart(month,@.CurrentDateStep) = datepart(month,@.CurrentDate)
    > Begin
    > set @.currentDate = @.CurrentDateStep
    > end
    > if datepart(month, @.CurrentDate) = 3
    > Begin
    > set @.CurrentDate = dateadd(day,2,@.CurrentDate)
    > end
    > end
    > Thanks in advance for any assistance.
    > Thanks,
    > SP
    >|||Hi,
    Pardon me for my ignorance, can you please elucidate with an example what
    you are trying to achieve?
    --
    -Omnibuzz (The SQL GC)
    http://omnibuzz-sql.blogspot.com/|||Sure. Sorry for the sparse information.
    At the company that I work for, they are always interested in a rolling
    calendar year. When I write reports with Reporting Services, they may run
    them for say 2006. The end date would always change depending on what month
    the report is run. For example, if the report is run today, they would want
    the results to show 6/1/2005 to 5/31/2006. If it gets run next month,
    7/1/2005 to 6/30/2006, etc.
    I always have to wrote some funky code to consider February, etc.
    I just thought if someone had written a UDF, that might help. Or send me in
    the right direction.
    I hope this clarifies things a little and I will definitely take a look at
    the Date table. I have done similiar things with an Access database, but
    didn't think about it for work.
    Thanks to all for looking.
    SP
    "Omnibuzz" wrote:

    > Hi,
    > Pardon me for my ignorance, can you please elucidate with an example wha
    t
    > you are trying to achieve?
    > --
    > -Omnibuzz (The SQL GC)
    > http://omnibuzz-sql.blogspot.com/
    >|||Maybe, this should work.. If I understood it wrong.. correct me..
    declare @.a datetime
    set @.a = getdate() -- Date on which you are running the report
    select
    dateadd(mm,datediff(mm,0,dateadd(yy,-1,@.a)),0) as Begin_dt,
    dateadd(mm,datediff(mm,0,@.a),0)-1 as end_dt
    -Omnibuzz (The SQL GC)
    http://omnibuzz-sql.blogspot.com/|||As written, the End_dt is midnight on the last day of the month, effectively
    leaving out all entries for that day.
    I would add one more dateadd step to include ALL times on the last day of th
    e month (up to 23:59:59.997)
    DECLARE @.Today datetime
    SET @.Today = getdate() -- Date on which you are running the report
    SELECT
    dateadd( mm, datediff( mm, 0, dateadd( yy, -1, @.Today )), 0 ) AS 'Begin_Dt'
    , dateadd( ms, -2, dateadd(mm, datediff( mm, 0, @.Today ), 0 ) ) AS 'End_Dt'
    --
    Arnie Rowland, YACE*
    "To be successful, your heart must accompany your knowledge."
    *Yet Another certification Exam
    "Omnibuzz" <Omnibuzz@.discussions.microsoft.com> wrote in message news:30BC1C01-180E-442C-8D
    BE-15E9B60B0C08@.microsoft.com...
    > Maybe, this should work.. If I understood it wrong.. correct me..
    >
    > declare @.a datetime
    > set @.a = getdate() -- Date on which you are running the report
    > select
    > dateadd(mm,datediff(mm,0,dateadd(yy,-1,@.a)),0) as Begin_dt,
    > dateadd(mm,datediff(mm,0,@.a),0)-1 as end_dt
    >
    > --
    > -Omnibuzz (The SQL GC)
    >
    > http://omnibuzz-sql.blogspot.com/
    >
    >|||I think it would be cleaner to use the next month's start instead of 3 ms
    earlier, and use < on the end_dt instead of <= (and obviously, don't use
    between).
    "Arnie Rowland" <arnie@.1568.com> wrote in message
    news:%23KeXiJIlGHA.4660@.TK2MSFTNGP05.phx.gbl...
    As written, the End_dt is midnight on the last day of the month, effectively
    leaving out all entries for that day.
    I would add one more dateadd step to include ALL times on the last day of
    the month (up to 23:59:59.997)
    DECLARE @.Today datetime
    SET @.Today = getdate() -- Date on which you are running the report
    SELECT
    dateadd( mm, datediff( mm, 0, dateadd( yy, -1, @.Today )), 0 ) AS
    'Begin_Dt'
    , dateadd( ms, -2, dateadd(mm, datediff( mm, 0, @.Today ), 0 ) ) AS
    'End_Dt'
    Arnie Rowland, YACE*
    "To be successful, your heart must accompany your knowledge."
    *Yet Another certification Exam
    "Omnibuzz" <Omnibuzz@.discussions.microsoft.com> wrote in message
    news:30BC1C01-180E-442C-8DBE-15E9B60B0C08@.microsoft.com...
    > Maybe, this should work.. If I understood it wrong.. correct me..
    > declare @.a datetime
    > set @.a = getdate() -- Date on which you are running the report
    > select
    > dateadd(mm,datediff(mm,0,dateadd(yy,-1,@.a)),0) as Begin_dt,
    > dateadd(mm,datediff(mm,0,@.a),0)-1 as end_dt
    > --
    > -Omnibuzz (The SQL GC)
    > http://omnibuzz-sql.blogspot.com/
    >|||Agreed.
    Arnie Rowland, YACE*
    "To be successful, your heart must accompany your knowledge."
    *Yet Another certification Exam
    "Aaron Bertrand [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
    news:OhBC5SIlGHA.984@.TK2MSFTNGP05.phx.gbl...
    >I think it would be cleaner to use the next month's start instead of 3 ms
    >earlier, and use < on the end_dt instead of <= (and obviously, don't use
    >between).
    >
    > "Arnie Rowland" <arnie@.1568.com> wrote in message
    > news:%23KeXiJIlGHA.4660@.TK2MSFTNGP05.phx.gbl...
    > As written, the End_dt is midnight on the last day of the month,
    > effectively leaving out all entries for that day.
    > I would add one more dateadd step to include ALL times on the last day of
    > the month (up to 23:59:59.997)
    > DECLARE @.Today datetime
    > SET @.Today = getdate() -- Date on which you are running the report
    > SELECT
    > dateadd( mm, datediff( mm, 0, dateadd( yy, -1, @.Today )), 0 ) AS
    > 'Begin_Dt'
    > , dateadd( ms, -2, dateadd(mm, datediff( mm, 0, @.Today ), 0 ) ) AS
    > 'End_Dt'
    > --
    > Arnie Rowland, YACE*
    > "To be successful, your heart must accompany your knowledge."
    > *Yet Another certification Exam
    >
    > "Omnibuzz" <Omnibuzz@.discussions.microsoft.com> wrote in message
    > news:30BC1C01-180E-442C-8DBE-15E9B60B0C08@.microsoft.com...
    >sql

    creating user and login problem

    When I try to create user using ent manager in mssql2000 it gives me error that there is already such user.But it actualy doesn't exists.

    How to solve this problem?

    Hi,

    did you check your logins by T-SQL?

    Code Snippet

    SELECT CAST(loginname AS CHAR(30)) AS loginname, sid, status, denylogin

    FROM master..syslogins

    ORDER BY sid

    |||

    when you say User... i am not sure , whether u r mentioning Login or Database User. I assume that it is Database user. In that case check whether there is any database role of the same name. The user name has to be unique for both users and role.

    if the below mentioned query returns row means there is some role exists in the datbase with the same name.

    select *from sysusers where name='YourUserName' and issqlrole=1

    Madhu

    |||

    Thanks for Answer

    I didn't find any such role or user name in the database.

    But When I connect through "sql server management tool" it lets me create the user.

    but the ent manager of 2000 doesn't allow.

    |||

    post the exact error no and description. also check in Event log for any clue

    Madhu

    Creating user

    Hi,
    I've just installed MSDE, and I'm wondering how to create user so I
    don't have to login as 'sa' user.
    Thanks in advance
    ukasz
    Try:
    sp_addlogin '<userName','<password>'
    Look for sp_addlogin / sp_grantlogin in the BOL.
    HTH, Jens Suessmeyer.
    |||Hi,
    To add on Jens:-
    MSDE will not come with GUI tools; so you need to login using OSQL to sql
    server and issue TSQL commands to create Logins and users.
    For eg; if you need to create a user HARI with read only rights in Finance
    database then:-
    From command line:-
    OSQL -S <servername> -Usa -P<sapassword> (enter)
    SP_addlogin 'hari','haripass'
    go <enter>
    Use Finance
    go <enter>
    sp_adduser 'hari'
    go <enter>
    sp_addrolemember 'db_datareader','hari'
    go <enter>
    he above commands will create user Hari with read rights in Finance
    database.
    Thanks
    Hari
    SQL Server MVP
    "Jens" <Jens@.sqlserver2005.de> wrote in message
    news:1126692828.991504.289480@.g47g2000cwa.googlegr oups.com...
    > Try:
    > sp_addlogin '<userName','<password>'
    > Look for sp_addlogin / sp_grantlogin in the BOL.
    > HTH, Jens Suessmeyer.
    >
    |||Hari Prasad wrote:
    > Hi,
    > To add on Jens:-
    > MSDE will not come with GUI tools; so you need to login using OSQL to sql
    > server and issue TSQL commands to create Logins and users.
    > For eg; if you need to create a user HARI with read only rights in Finance
    > database then:-
    > From command line:-
    > OSQL -S <servername> -Usa -P<sapassword> (enter)
    > SP_addlogin 'hari','haripass'
    > go <enter>
    > Use Finance
    > go <enter>
    > sp_adduser 'hari'
    > go <enter>
    > sp_addrolemember 'db_datareader','hari'
    > go <enter>
    > he above commands will create user Hari with read rights in Finance
    > database.
    > Thanks
    > Hari
    > SQL Server MVP
    >
    >
    > "Jens" <Jens@.sqlserver2005.de> wrote in message
    > news:1126692828.991504.289480@.g47g2000cwa.googlegr oups.com...
    >
    >
    Thanks.
    |||Hari Prasad wrote:
    > Hi,
    > To add on Jens:-
    > MSDE will not come with GUI tools; so you need to login using OSQL to sql
    > server and issue TSQL commands to create Logins and users.
    > For eg; if you need to create a user HARI with read only rights in Finance
    > database then:-
    > From command line:-
    > OSQL -S <servername> -Usa -P<sapassword> (enter)
    > SP_addlogin 'hari','haripass'
    > go <enter>
    > Use Finance
    > go <enter>
    > sp_adduser 'hari'
    > go <enter>
    > sp_addrolemember 'db_datareader','hari'
    > go <enter>
    > he above commands will create user Hari with read rights in Finance
    > database.
    > Thanks
    > Hari
    > SQL Server MVP
    >
    >
    > "Jens" <Jens@.sqlserver2005.de> wrote in message
    > news:1126692828.991504.289480@.g47g2000cwa.googlegr oups.com...
    >
    >
    Thanks
    ukasz

    Creating UDT from another UDT

    Hi,
    I have a User Defined Datatype, which I want to use to define another
    data-type. I tried the obvious:

    EXEC sp_addtype
    @.typename = UDT_OBJECT_ID,
    @.phystype = 'NUMERIC (5)',
    @.nulltype = 'NULL'
    GO

    EXEC sp_addtype
    @.typename = UDT_TRACKING_NUM,
    @.phystype = UDT_OBJECT_ID,
    @.nulltype = 'NOT NULL'
    GO

    but that didn't work :

    Msg 15036, Level 16, State 1, Server SKINNER, Procedure sp_addtype, Line 186
    The data type UDT_OBJECT_ID does not exist.

    Has anyone done this before,

    Thanks,
    Rowland."Rowland" <banksr0@.hotmail.com> wrote in message
    news:cg2b5e$njt$1@.titan.btinternet.com...
    > Hi,
    > I have a User Defined Datatype, which I want to use to define another
    > data-type. I tried the obvious:
    > EXEC sp_addtype
    > @.typename = UDT_OBJECT_ID,
    > @.phystype = 'NUMERIC (5)',
    > @.nulltype = 'NULL'
    > GO
    > EXEC sp_addtype
    > @.typename = UDT_TRACKING_NUM,
    > @.phystype = UDT_OBJECT_ID,
    > @.nulltype = 'NOT NULL'
    > GO
    > but that didn't work :
    > Msg 15036, Level 16, State 1, Server SKINNER, Procedure sp_addtype, Line
    > 186
    > The data type UDT_OBJECT_ID does not exist.
    > Has anyone done this before,
    > Thanks,
    > Rowland.

    No - see the documentation for sp_addtype. You can only create a UDDT based
    on a native MSSQL data type, not on another UDDT.

    The best way to manage this is probably to script your UDDTs, so you can
    create a new one by just changing the name in the script.

    Simon|||"Simon Hayes" <sql@.hayes.ch> wrote in message
    news:4124ed6b$1_2@.news.bluewin.ch...
    > "Rowland" <banksr0@.hotmail.com> wrote in message
    > news:cg2b5e$njt$1@.titan.btinternet.com...
    > > Hi,
    > > I have a User Defined Datatype, which I want to use to define another
    > > data-type. I tried the obvious:
    > > EXEC sp_addtype
    > > @.typename = UDT_OBJECT_ID,
    > > @.phystype = 'NUMERIC (5)',
    > > @.nulltype = 'NULL'
    > > GO
    > > EXEC sp_addtype
    > > @.typename = UDT_TRACKING_NUM,
    > > @.phystype = UDT_OBJECT_ID,
    > > @.nulltype = 'NOT NULL'
    > > GO
    > > but that didn't work :
    > > Msg 15036, Level 16, State 1, Server SKINNER, Procedure sp_addtype, Line
    > > 186
    > > The data type UDT_OBJECT_ID does not exist.
    > > Has anyone done this before,
    > > Thanks,
    > > Rowland.
    > No - see the documentation for sp_addtype. You can only create a UDDT
    based
    > on a native MSSQL data type, not on another UDDT.
    > The best way to manage this is probably to script your UDDTs, so you can
    > create a new one by just changing the name in the script.
    > Simon

    Thanks for the info - I think scripting the UDDTs should work well in my
    case, so I'll give that a go.

    Rowland.

    Creating UDF?

    I find PLENTY of examples of User Defined functions. However, I
    struggle to see how/where to SAVE this function! I can go under the
    database, Programmability, Functions, Scalar Functions, and create a
    scalar function. However, when I click SAVE I get prompted to save the
    .sql file to disk. If I close that (query) tab, then the function is
    gone as well.
    How do I persist the function in a database?Once you have coded your function, you need to execute it. When you use
    Programmability > Functions > New > Scalar-valued Function, what SSMS is
    doing is just giving you a template that you fill out. Once done, you need
    to execute it (using the Execute button on the toolbar). This will then
    persist it. The "Save" option is to save what you have written into disk.
    --
    HTH,
    SriSamp
    Email: srisamp@.gmail.com
    Blog: http://blogs.sqlxml.org/srinivassampath
    URL: http://www32.brinkster.com/srisamp
    <mikes@.vmsmailingservices.com> wrote in message
    news:1132627531.702420.199000@.z14g2000cwz.googlegroups.com...
    >I find PLENTY of examples of User Defined functions. However, I
    > struggle to see how/where to SAVE this function! I can go under the
    > database, Programmability, Functions, Scalar Functions, and create a
    > scalar function. However, when I click SAVE I get prompted to save the
    > .sql file to disk. If I close that (query) tab, then the function is
    > gone as well.
    > How do I persist the function in a database?
    >

    Creating UDF In SQL Server 2005?

    I find PLENTY of examples of User Defined functions. However, I
    struggle to see how/where to SAVE this function! I can go under the
    database, Programmability, Functions, Scalar Functions, and create a
    scalar function. However, when I click SAVE I get prompted to save the
    .sql file to disk. If I close that (query) tab, then the function is
    gone as well.
    How do I persist the function in a database? I should note that this is
    for SQL Server 2005.<mikes@.vmsmailingservices.com> wrote in message
    news:1132627572.039473.90980@.g47g2000cwa.googlegroups.com...
    > I find PLENTY of examples of User Defined functions. However, I
    > struggle to see how/where to SAVE this function! I can go under
    the
    > database, Programmability, Functions, Scalar Functions, and create
    a
    > scalar function. However, when I click SAVE I get prompted to save
    the
    > .sql file to disk. If I close that (query) tab, then the function
    is
    > gone as well.
    > How do I persist the function in a database? I should note that
    this is
    > for SQL Server 2005.
    >
    mikes,
    The .sql files are just text files with another extension. Of
    course you want to save them as your scripts, but if you want to
    check out your stored procedures and functions in the database,
    then:
    SELECT R1.*
    FROM INFORMATION_SCHEMA.ROUTINES AS R1
    Sincerely,
    Chris O.|||Hi Mike,
    When you run the text that you have just created then teh SQL server creates
    the object in the database. The text is no longer needed by the SQL Server.
    You should however save this text to a file and that file can be stored
    anywhere you like
    kind regards
    Greg O
    --
    Looking to use CLR in SQL 2005. Try some pre-build CLR Functions and SP
    AGS SQL 2005 Utilities, over 20+ functions
    http://www.ag-software.com/?tabid=38
    <mikes@.vmsmailingservices.com> wrote in message
    news:1132627572.039473.90980@.g47g2000cwa.googlegroups.com...
    >I find PLENTY of examples of User Defined functions. However, I
    > struggle to see how/where to SAVE this function! I can go under the
    > database, Programmability, Functions, Scalar Functions, and create a
    > scalar function. However, when I click SAVE I get prompted to save the
    > .sql file to disk. If I close that (query) tab, then the function is
    > gone as well.
    > How do I persist the function in a database? I should note that this is
    > for SQL Server 2005.
    >|||Why save it when sql will give you the create statement any time you need
    it?
    William Stacey [MVP]
    "GregO" <grego@.community.nospam> wrote in message
    news:e8rKpwx7FHA.2816@.tk2msftngp13.phx.gbl...
    > Hi Mike,
    > When you run the text that you have just created then teh SQL server
    > creates the object in the database. The text is no longer needed by the
    > SQL Server. You should however save this text to a file and that file can
    > be stored anywhere you like
    > kind regards
    > Greg O
    > --
    > Looking to use CLR in SQL 2005. Try some pre-build CLR Functions and SP
    > AGS SQL 2005 Utilities, over 20+ functions
    > http://www.ag-software.com/?tabid=38
    > <mikes@.vmsmailingservices.com> wrote in message
    > news:1132627572.039473.90980@.g47g2000cwa.googlegroups.com...
    >|||Hello mikes@.vmsmailingservices.com,

    > I find PLENTY of examples of User Defined functions. However, I
    > struggle to see how/where to SAVE this function! I can go under the
    > database, Programmability, Functions, Scalar Functions, and create a
    > scalar function. However, when I click SAVE I get prompted to save the
    > .sql file to disk. If I close that (query) tab, then the function is
    > gone as well.
    > How do I persist the function in a database? I should note that this
    > is for SQL Server 2005.
    Rephrasing some of the answers you've gotten thus far, as soon as you execut
    e
    the CREATE FUNCTION statement, a "complied" version of the function is commi
    tted
    to the database. There's no need to save the text version of it, since, when
    you issued that same CREATE FUNCTION statement, SQL Server also saved that
    to the database.
    Make sense?
    Thank you,
    Kent Tegels
    DevelopMentor
    http://staff.develop.com/ktegels/|||Hi William
    Seriously?
    What happens when some deletes it or changes the structure. You need
    something to compare it to. There so many reasons for keeping the command
    syntax and next to none for not keeping it. When in doubt keep the command.
    kind regards
    Greg O
    --
    Looking to use CLR in SQL 2005. Try some pre-build CLR Functions and SP
    AGS SQL 2005 Utilities, over 20+ functions
    http://www.ag-software.com/?tabid=38
    "William Stacey [MVP]" <william.stacey@.gmail.com> wrote in message
    news:OVdiJWy7FHA.472@.TK2MSFTNGP15.phx.gbl...
    > Why save it when sql will give you the create statement any time you need
    > it?
    > --
    > William Stacey [MVP]
    > "GregO" <grego@.community.nospam> wrote in message
    > news:e8rKpwx7FHA.2816@.tk2msftngp13.phx.gbl...
    >|||>
    > Rephrasing some of the answers you've gotten thus far, as soon as you exec
    ute
    > the CREATE FUNCTION statement, a "complied" version of the function is com
    mitted
    > to the database. There's no need to save the text version of it, since, wh
    en
    > you issued that same CREATE FUNCTION statement, SQL Server also saved that
    > to the database.
    > Make sense?
    > Thank you,
    > Kent Tegels
    > DevelopMentor
    > http://staff.develop.com/ktegels/
    This helps a lot, thanks everyone!
    a couple more related questions, based on your responses...
    How does the DB engine manage a new function of the same name? Prompted
    to override?
    How can one determine a list of the functions in a database?
    How is (function) debugging done, if the function is internal to the DB
    Engine?|||Hello mikes@.vmsmailingservices.com,

    > How does the DB engine manage a new function of the same name?
    > Prompted to override?
    No, unlike other development tools, most of the SQL Server tools *trusts*
    the operator to know what he or she is doing. Most shops have a CVS (or simi
    lar)
    set up for storing scripts for objects. MS is offering one with team system
    too. Native integration of that into SQL Server is probably a couple of vers
    ions
    away I suspect.

    > How can one determine a list of the functions in a database?
    select * from sys.objects where type_desc like '%_FUNCTION'

    > How is (function) debugging done, if the function is internal to the
    > DB Engine?
    Like any other environment, the execution engine know that it has breakpoint
    s
    that it yields control to another process. It just so happens that SQL Serve
    r's
    engine uses a common Visual Studio API for debugging. No magic.
    Thank you,
    Kent Tegels
    DevelopMentor
    http://staff.develop.com/ktegels/