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

Friday, March 30, 2012

How do I append string to end of sql query results?

I need to append text to the end of my sql query results.

For instance, my query returns a list of user names in
firstname.lastname. I need to add @.yahoo.com to each record. So the
end result should be firstname.lastname@.yahoo.com. What should by
select statement look like?

Any help?"diesel" <dieselpb03@.yahoo.com> skrev i en meddelelse
news:854ece22.0407131219.6f38c10a@.posting.google.c om...
> I need to append text to the end of my sql query results.
> For instance, my query returns a list of user names in
> firstname.lastname. I need to add @.yahoo.com to each record. So the
> end result should be firstname.lastname@.yahoo.com. What should by
> select statement look like?
> Any help?

SELECT Firstname + '.' + Lastname + '@.yahoo.com' AS Name
FROM tblPerson

easypeasy

--
Med venlig hilsen

Tom F Jensen
FFSoft
www.ffsoft.dk|||Maybe:

SELECT name + '@.yahoo.com'
FROM YourTable

--
David Portas
SQL Server MVP
--

How do I allow users to schedule jobs in Management Studio

Does anyone know how I can grant a non sysdba user who has bulkadmin and dbcreator rights to schedule jobs on databases they've created?

The user is a developer and we dont want to give him sysdba rights.

http://www.sql-server-performance.com//faq/?f=137

How do I allow an end user make modifications to a rdl that I created using Report Designe

Hi,
I have several reports ( .rdl) that I created using report designer, how can
I let the end user make modifications to the text in some of these reports.
As I am unable to use Report Builder to modify reports ( .rdl ) created with
Report designer, what are my options. is there a way I can embed the report
designer within my c# winform application. I have tried converting/creating
a report builder version but with no success..
Thanks in advance..On Mar 2, 3:09 pm, "Rob Dob" <robdob20012...@.yahoo.com> wrote:
> Hi,
> I have several reports ( .rdl) that I created using report designer, how can
> I let the end user make modifications to the text in some of these reports.
> As I am unable to use Report Builder to modify reports ( .rdl ) created with
> Report designer, what are my options. is there a way I can embed the report
> designer within my c# winform application. I have tried converting/creating
> a report builder version but with no success..
> Thanks in advance..
Hi there...if you are running SSRS 2005 I would make the report using
the report builder if at all possible then give the user rights to
change it. There probably are other ways of doing this but I think
this might be the easiest...|||On Mar 2, 5:21 pm, "sullins602" <ben.sull...@.gmail.com> wrote:
> On Mar 2, 3:09 pm, "Rob Dob" <robdob20012...@.yahoo.com> wrote:
> > Hi,
> > I have several reports ( .rdl) that I created using report designer, how can
> > I let the end user make modifications to the text in some of these reports.
> > As I am unable to use Report Builder to modify reports ( .rdl ) created with
> > Report designer, what are my options. is there a way I can embed the report
> > designer within my c# winform application. I have tried converting/creating
> > a report builder version but with no success..
> > Thanks in advance..
> Hi there...if you are running SSRS 2005 I would make the report using
> the report builder if at all possible then give the user rights to
> change it. There probably are other ways of doing this but I think
> this might be the easiest...
Also, depending on the text that needs to be changed, you could allow
certain text report parameters to be filled in by the user and use the
parameter results to set the text in the report.
Regards,
Enrique Martinez
Sr. SQL Server Developer

How do I add ASPNET user to SQLExpress DB?

I am going though the ASP.NET QuickStart tutorials. One of the lessons is to add a datagrid. I am able to do that with VWD and am able to connect to the database in VWD. However when I try to execute the application I get a "Login failure" message because the user pcName/ASPNET cannot login.

How do I add the ASPNET user to the SQLExpress database? There don't seem to be any administration tools that were installed with SQL Server Express 2005.

Thanks in advance for the help!

There are two permissions to SQL Server the Server permissions under security in Management in Management Studio and the new security section within the database. The management tools are a separate download. Hope this helps.

http://msdn.microsoft.com/vstudio/express/sql/compare/default.aspx

|||Thank you so much! It worked!|||

the link you posted is taking me to sqlexpress home page. And I don't see anything that is related to our discussion. Could you help little more and send me what I need to do in order to add aspnet user to sqlexpress??

thanks

Cemal

how do I add a user?

Seems like such a simple thing. But I am pulling my hair out.
Using SQL Server 2000, SP4, on Windows 2000 Server.
I'm moving an ASP-built web app from one machine to another. It works on the
old one, not on the new. Specifically, the error I get is:
Microsoft OLE DB Provider for SQL Server (0x80040E4D)
Login failed for user 'XXX'.
(where I replaced the login name with X's.)
So I am looking on the old machine (the one that works) and the new one, to
see what differences I notice, and sure enough, in the old one, under Users,
I see the user called XXX. So I go to my new one, which doesn't have a user
by that name, and I attempt to add it. But it doesn't let me add it. In
fact, I am not sure how to add it. I right-click on Users, and try to fill
in the user name but it says that that user doesn't exist, so I can't add
it. Which is ridiculous. I mean, how does any user exist if you don't get a
chance to add them?
Middletree wrote:
> Seems like such a simple thing. But I am pulling my hair out.
> Using SQL Server 2000, SP4, on Windows 2000 Server.
> I'm moving an ASP-built web app from one machine to another. It works on the
> old one, not on the new. Specifically, the error I get is:
> Microsoft OLE DB Provider for SQL Server (0x80040E4D)
> Login failed for user 'XXX'.
> (where I replaced the login name with X's.)
>
> So I am looking on the old machine (the one that works) and the new one, to
> see what differences I notice, and sure enough, in the old one, under Users,
> I see the user called XXX. So I go to my new one, which doesn't have a user
> by that name, and I attempt to add it. But it doesn't let me add it. In
> fact, I am not sure how to add it. I right-click on Users, and try to fill
> in the user name but it says that that user doesn't exist, so I can't add
> it. Which is ridiculous. I mean, how does any user exist if you don't get a
> chance to add them?
>
>
You have to first create a LOGIN, then map that LOGIN to a database as a
USER. When you moved the database from the old server to the new, how
did you do it? If you did a backup/restore, you'll have to first drop
the user from the database before mapping the login. The user SID (an
internal ID) is stamped in the database referencing the user from the
original server.
Tracy McKibben
MCDBA
http://www.realsqlguy.com
|||I did a detach/reattach.
Your suggestion worked. Thanks!

how do I add a user?

Seems like such a simple thing. But I am pulling my hair out.
Using SQL Server 2000, SP4, on Windows 2000 Server.
I'm moving an ASP-built web app from one machine to another. It works on the
old one, not on the new. Specifically, the error I get is:
Microsoft OLE DB Provider for SQL Server (0x80040E4D)
Login failed for user 'XXX'.
(where I replaced the login name with X's.)
So I am looking on the old machine (the one that works) and the new one, to
see what differences I notice, and sure enough, in the old one, under Users,
I see the user called XXX. So I go to my new one, which doesn't have a user
by that name, and I attempt to add it. But it doesn't let me add it. In
fact, I am not sure how to add it. I right-click on Users, and try to fill
in the user name but it says that that user doesn't exist, so I can't add
it. Which is ridiculous. I mean, how does any user exist if you don't get a
chance to add them?Middletree wrote:
> Seems like such a simple thing. But I am pulling my hair out.
> Using SQL Server 2000, SP4, on Windows 2000 Server.
> I'm moving an ASP-built web app from one machine to another. It works on the
> old one, not on the new. Specifically, the error I get is:
> Microsoft OLE DB Provider for SQL Server (0x80040E4D)
> Login failed for user 'XXX'.
> (where I replaced the login name with X's.)
>
> So I am looking on the old machine (the one that works) and the new one, to
> see what differences I notice, and sure enough, in the old one, under Users,
> I see the user called XXX. So I go to my new one, which doesn't have a user
> by that name, and I attempt to add it. But it doesn't let me add it. In
> fact, I am not sure how to add it. I right-click on Users, and try to fill
> in the user name but it says that that user doesn't exist, so I can't add
> it. Which is ridiculous. I mean, how does any user exist if you don't get a
> chance to add them?
>
>
You have to first create a LOGIN, then map that LOGIN to a database as a
USER. When you moved the database from the old server to the new, how
did you do it? If you did a backup/restore, you'll have to first drop
the user from the database before mapping the login. The user SID (an
internal ID) is stamped in the database referencing the user from the
original server.
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||I did a detach/reattach.
Your suggestion worked. Thanks!

how do I add a user?

Seems like such a simple thing. But I am pulling my hair out.
Using SQL Server 2000, SP4, on Windows 2000 Server.
I'm moving an ASP-built web app from one machine to another. It works on the
old one, not on the new. Specifically, the error I get is:
Microsoft OLE DB Provider for SQL Server (0x80040E4D)
Login failed for user 'XXX'.
(where I replaced the login name with X's.)
So I am looking on the old machine (the one that works) and the new one, to
see what differences I notice, and sure enough, in the old one, under Users,
I see the user called XXX. So I go to my new one, which doesn't have a user
by that name, and I attempt to add it. But it doesn't let me add it. In
fact, I am not sure how to add it. I right-click on Users, and try to fill
in the user name but it says that that user doesn't exist, so I can't add
it. Which is ridiculous. I mean, how does any user exist if you don't get a
chance to add them?Middletree wrote:
> Seems like such a simple thing. But I am pulling my hair out.
> Using SQL Server 2000, SP4, on Windows 2000 Server.
> I'm moving an ASP-built web app from one machine to another. It works on t
he
> old one, not on the new. Specifically, the error I get is:
> Microsoft OLE DB Provider for SQL Server (0x80040E4D)
> Login failed for user 'XXX'.
> (where I replaced the login name with X's.)
>
> So I am looking on the old machine (the one that works) and the new one, t
o
> see what differences I notice, and sure enough, in the old one, under User
s,
> I see the user called XXX. So I go to my new one, which doesn't have a use
r
> by that name, and I attempt to add it. But it doesn't let me add it. In
> fact, I am not sure how to add it. I right-click on Users, and try to fill
> in the user name but it says that that user doesn't exist, so I can't add
> it. Which is ridiculous. I mean, how does any user exist if you don't get
a
> chance to add them?
>
>
You have to first create a LOGIN, then map that LOGIN to a database as a
USER. When you moved the database from the old server to the new, how
did you do it? If you did a backup/restore, you'll have to first drop
the user from the database before mapping the login. The user SID (an
internal ID) is stamped in the database referencing the user from the
original server.
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||I did a detach/reattach.
Your suggestion worked. Thanks!

Wednesday, March 28, 2012

How do I add 1000+ New Users to ASPNET_DB?

Ok some company has handed me this .xls file containing a 1000+ users -- their emails (which are to be their user names), and their passwords. Both are in plain text format. I want to add these users to the ASPNET_DB, with the condition that the passwords and userids are encrypted, as they are in the table.

How should I do this?

Thanks very much.

The encryption should be in a client side form. You don't want to encrypt a datatype on the DB end and attempt to decrpt it for display.

Create the Table as normal with both the username and password fields as varchar's. Use the import/export wizard to dump it in.

Encrypt the text box control on your form when entering.

<input id="Password1" type="password" />

It'll match against your varchar.

Adamus

|||No, I do want to encrypt the password and user name actually.|||

Why is this a TSQL question? Do you want to perform the encryption on the client? Who will need to decrypt the username/password? What accesses the table? There are many questions and depending on that you can pick a method. Below are some ideas:

1. If you need to encrypt / decrypt the username & password combination on the client then it is best to use some algorithm that you can use on the client. So write a program that will encrypt the Excel data and produce a file. You can then load the file into the database

2. You could also use SQLCLR and use one of the Crypto API classes to do the encryption / decryption. You can then use it on the server-side easily.

And it seems like you should post this in the security newsgroup also. Deciding what level of encryption to use and the purpose of encryption depends on your requirements. The security guys will be able to help on the choice of the encryption algorithm or technology.

How do disable a user to "Generate SQL Scripts"

I have an SQLServer 2000 instance with a DataBase.
I have 2 users: sa, new_user.
The [new_user] has membership role: public, db_datareader, db_datawriter
It has permissions to manipulate some table and stored procedures. He can
not export, import, backup, restore the data base.
The point is that he can generate a script for the all database!!!
How do I disable it?
Can some one give me some help on this issue.
Thanks,
JoaoRegoSince you give the user db_datareader membership, then they can read
anything in the database, including the structure of the tables.
You can deny permissions to system tables like sysobjects to prevent listing
tables for example, like so ->
deny select on sysobjects to user1
This would prevent user1 from getting a list of tables for example.
Another common scheme is to only allow user's access to views and totally
restrict access to the actual underlying tables.
Matt Neerincx [MSFT]
This posting is provided "AS IS", with no warranties, and confers no rights.
Please do not send email directly to this alias. This alias is for newsgroup
purposes only.
"Joao Rego" <Joao Rego@.discussions.microsoft.com> wrote in message
news:4B2E9F96-E012-4CF3-8033-A19A6E0DD797@.microsoft.com...
>I have an SQLServer 2000 instance with a DataBase.
> I have 2 users: sa, new_user.
> The [new_user] has membership role: public, db_datareader, db_datawrit
er
> It has permissions to manipulate some table and stored procedures. He can
> not export, import, backup, restore the data base.
> The point is that he can generate a script for the all database!!!
> How do I disable it?
> Can some one give me some help on this issue.
> Thanks,
> JoaoRegosql

How do a get a listing of all available SQL Servers on a network.

I want to create a web app that will allow a user to select from a drop down or lookup all available SQL Server databases.

Thanks in advance,
Jeremyi answered my own question... hope this helps some one

To restate my problem.
I need an app that will list all of the available SQL Servers on a network. There are many ways to do this ... this is one. I would like to see better ways if anyone has time.

1. Download the SQLUtils.dll from (watch for line wrap)
http://codeproject.com/useritems/listsqlservers.asp?print=true

2. Register the SQLUtils.dll using regsvr32.exe
> regsvr32 c:/inetpub/wwwroot/lib/sqlutils.dll

3. Build your web form

// C#

using SQLUtils;

protected System.Web.UI.WebControls.TextBox TextBox1;
protected System.Web.UI.WebControls.Button Button1;
protected System.Web.UI.WebControls.ListBox ListBox1;

private void Button1_Click(object sender, System.EventArgs e)
{
SQLUtils.ListServers oSqlUtils = new SQLUtils.ListServers();
// String svr = new String();
oSqlUtils.Domain = TextBox1.Text;
oSqlUtils.GetSQLServers();
foreach( String svr in oSqlUtils.Servers )
{
ListBox1.Items.Add(svr);
} // end of foreach loop
} // end of Button1_Click()

4. You will need to add a reference in your project to the .dll file. Right click on the project and select "Add Reference". Browse to the location and select.

I also found these... (watch for line wrap)
http://www.windows2000faq.com/Articles/Index.cfm?ArticleID=14327

Monday, March 26, 2012

how did guest get back into all of my databases?

i clearly remember deleting the guest user from all of my sql2000
databases a couple of years ago.
the guest user is now back in all of my databases on all of my servers
and i can't tell when or where it came from.
at first, i thought sp4 might have done it, but i've still got one
server running sp3 that also has the guest user in all databases.
i guess the next logical guess might be the hotfix that got you to
version 818.
anybody know if there was actually a patch or service pack (either db or
operating system) that re-added the guest user to each database?
i feel sort of silly because it's apparently been there for months and
i'm just now noticing it.
Is the 'guest' user actually enabled? You should always have a row for
'guest' user in sysusers in all databases but the 'guest' user is enabled
only if it is listed when you execute sp_helpuser.
Hope this helps.
Dan Guzman
SQL Server MVP
"ch" <ch@.dontemailme.com> wrote in message
news:43A16C3E.CB03F014@.dontemailme.com...
>i clearly remember deleting the guest user from all of my sql2000
> databases a couple of years ago.
> the guest user is now back in all of my databases on all of my servers
> and i can't tell when or where it came from.
> at first, i thought sp4 might have done it, but i've still got one
> server running sp3 that also has the guest user in all databases.
> i guess the next logical guess might be the hotfix that got you to
> version 818.
> anybody know if there was actually a patch or service pack (either db or
> operating system) that re-added the guest user to each database?
> i feel sort of silly because it's apparently been there for months and
> i'm just now noticing it.

how did guest get back into all of my databases?

i clearly remember deleting the guest user from all of my sql2000
databases a couple of years ago.
the guest user is now back in all of my databases on all of my servers
and i can't tell when or where it came from.
at first, i thought sp4 might have done it, but i've still got one
server running sp3 that also has the guest user in all databases.
i guess the next logical guess might be the hotfix that got you to
version 818.
anybody know if there was actually a patch or service pack (either db or
operating system) that re-added the guest user to each database?
i feel sort of silly because it's apparently been there for months and
i'm just now noticing it.Is the 'guest' user actually enabled? You should always have a row for
'guest' user in sysusers in all databases but the 'guest' user is enabled
only if it is listed when you execute sp_helpuser.
--
Hope this helps.
Dan Guzman
SQL Server MVP
"ch" <ch@.dontemailme.com> wrote in message
news:43A16C3E.CB03F014@.dontemailme.com...
>i clearly remember deleting the guest user from all of my sql2000
> databases a couple of years ago.
> the guest user is now back in all of my databases on all of my servers
> and i can't tell when or where it came from.
> at first, i thought sp4 might have done it, but i've still got one
> server running sp3 that also has the guest user in all databases.
> i guess the next logical guess might be the hotfix that got you to
> version 818.
> anybody know if there was actually a patch or service pack (either db or
> operating system) that re-added the guest user to each database?
> i feel sort of silly because it's apparently been there for months and
> i'm just now noticing it.sql

how did guest get back into all of my databases?

i clearly remember deleting the guest user from all of my sql2000
databases a couple of years ago.
the guest user is now back in all of my databases on all of my servers
and i can't tell when or where it came from.
at first, i thought sp4 might have done it, but i've still got one
server running sp3 that also has the guest user in all databases.
i guess the next logical guess might be the hotfix that got you to
version 818.
anybody know if there was actually a patch or service pack (either db or
operating system) that re-added the guest user to each database?
i feel sort of silly because it's apparently been there for months and
i'm just now noticing it.Is the 'guest' user actually enabled? You should always have a row for
'guest' user in sysusers in all databases but the 'guest' user is enabled
only if it is listed when you execute sp_helpuser.
Hope this helps.
Dan Guzman
SQL Server MVP
"ch" <ch@.dontemailme.com> wrote in message
news:43A16C3E.CB03F014@.dontemailme.com...
>i clearly remember deleting the guest user from all of my sql2000
> databases a couple of years ago.
> the guest user is now back in all of my databases on all of my servers
> and i can't tell when or where it came from.
> at first, i thought sp4 might have done it, but i've still got one
> server running sp3 that also has the guest user in all databases.
> i guess the next logical guess might be the hotfix that got you to
> version 818.
> anybody know if there was actually a patch or service pack (either db or
> operating system) that re-added the guest user to each database?
> i feel sort of silly because it's apparently been there for months and
> i'm just now noticing it.

Friday, March 23, 2012

How could this have happened ??

Hi everybody!

Something strange happened to one of my SQL Databases.
One of my User Defined Funcitions has lost ALL its roles permissions!

I created this UDF a long time ago and I assigned permissions to some specific Roles to run the UDF. It worked fine until today. All of a sudden there were no permissions for any role for that UDF. I am the only Admin for the DB.

I reassigned the roles permissions and it seems to be working fine now.
How could this happen ? has anyone here experienced something like this before ?

Thanks!Basic questions - How often is it accessed ? Have you noticed any other settings modified - I am thinking of sql injection here - it is a remote possibility that someone could have breached your system. Have you done any replication/copy database/copy objects between other servers ?|||Originally posted by rnealejr
Basic questions - How often is it accessed ? Have you noticed any other settings modified - I am thinking of sql injection here - it is a remote possibility that someone could have breached your system. Have you done any replication/copy database/copy objects between other servers ?

It is accessed on a daily basis (about 25 users). Intranet users only (no external logins). Also, no replication/db copy between other servers.|||Why don't you post the udf...|||You are sure you are the only admin? Try running

sp_helpsrvrolemember sysadmin
and
sp_helpsrvrolemember securityadmin

If any other names show up in these, you may have a problem. Also check on sp_helpdb (your database) who is listed as the owner of the database? And check sp_helprolemember db_owner as well. Any of these folks could tamper with permissions. Some of them could drop/rebuild the function, which strips permissions.

To check if the procedure has been dropped/rebuilt. Run
select crdate
from sysobjects
where name = 'functionname'

If crdate (creation date) is recent, you may have your culprit there.|||Or it's the Miracle thing again....|||Is the server on 34th street, Brett? ;-) I would hate to hear that SQL security is as good as say...MS Word.

http://www.techworld.com/news/index.cfm?fuseaction=displaynews&NewsID=845|||Nice article - Just call me Kris ... Kringle that is.

Seriously, as already mentioned check to see if other admins exist.|||Originally posted by MCrowley
Is the server on 34th street, Brett? ;-) I would hate to hear that SQL security is as good as say...MS Word.

http://www.techworld.com/news/index.cfm?fuseaction=displaynews&NewsID=845

Cool...as or I like to say...Microsoft Swiss Cheese

and as far as miracles go...

I've known too many developers who don't realize it's their fault...

It's gotta be the computer...or It's a Miracle

How did all that data dissapear from the table...I didn't do ANYTHING...|||Oh and btw...I bet the udf was dropped and recompiled...

takers?|||That's about where I would start looking, Brett.|||"I didn't truncate that table" - oops :-)

Brett - you are correct about that one - I actually had a developer truncate a table - to only ask what happened... However, dropping permissions is more of a cognitive action - I least I hope ... Especially since this udf is accessed daily, you would have a shorter time span to recollect your thoughts about what you did that might have affected it. I still would not be surprised if it is a microsoft miracle because I have seen this behavior before (but only with replicated objects).

Dropping and recompiling would do it - however, the create date would have changed.|||[CTRL-E]

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[udf_MI]') and xtype in (N'FN', N'IF', N'TF'))
drop function [dbo].[udf_MI]
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE FUNCTION udf_MI
(@.x varchar(256))
RETURNS char(1)
AS
BEGIN
DECLARE @.y char(1)
SELECT @.x = REPLACE(@.x,'.','')
SELECT @.y = CASE WHEN PATINDEX('% [a-zA-Z] %', @.x) > 0
THEN SUBSTRING(@.x,PATINDEX('% [a-zA-Z] %',@.x)+ 1,1)
ELSE NULL
END
RETURN @.y
END

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

ooooooooooopppppppppppppppppppppssssssssssssssssss|||Originally posted by MCrowley
You are sure you are the only admin? Try running

sp_helpsrvrolemember sysadmin
and
sp_helpsrvrolemember securityadmin

If any other names show up in these, you may have a problem. Also check on sp_helpdb (your database) who is listed as the owner of the database? And check sp_helprolemember db_owner as well. Any of these folks could tamper with permissions. Some of them could drop/rebuild the function, which strips permissions.

To check if the procedure has been dropped/rebuilt. Run
select crdate
from sysobjects
where name = 'functionname'

If crdate (creation date) is recent, you may have your culprit there.

Yep! crdate is yesterday's date, that's when i found out that the permissions were dropped! (I originally created this function months ago!).

Is there a way to find out who dropped it, if any ?|||Since you are the only admin, YOU dropped it! Eh? ;)

Seriously, you may be the only admin, but does anybody else have a login with dbo priveleges?

blindman|||Originally posted by blindman
Since you are the only admin, YOU dropped it! Eh? ;)

Seriously, you may be the only admin, but does anybody else have a login with dbo priveleges?

blindman

I am the only Admin .. and UNLESS I was drunk (doubtful since I don't drink) or I was walking while asleep (which is also doubtful :o) .. )

Seriously, I am sure I have not dropped the function. I am still puzzled!|||Well, maybe it is time you have a drink :-). Is it identical to your original script ... Is it stored in a script ? If you did not drop/recreate the udf, then I would expect differences between the two. Also, as blindman already mentioned start to look for users that would have access to drop/recreate the udf.|||Originally posted by rnealejr
Well, maybe it is time you have a drink :-). Is it identical to your original script ... Is it stored in a script ? As blindman already mentioned start to look for users that would have access to drop/recreate the udf.

END OF THE DILEMMA!

This might sound obvious to some of you. But it sure is new to me (with my very limited experience with SQL Server).
What happened is that I modified the User Defined function yesterday. And that (for some reason that I still don't understand) deleted all the permissions. Or more accurately it dropped and recreated the function.

Now to make sure that was the case, I created a test function and test stored procedure. When I modified the stored procedure nothing was lost (the permissions were still there) but when I modified the function, all permissions disappeared (function dropped/recreated automatically).

Is this something that SQL server does by definition or is it strange to you guys too ?

Thanks!|||Holy-moly !!! That was critical information you left out - that you were modified the function !!! Anytime you modify something and that thing is altered from its normal behavior means that what you did caused it. Kudos to mcrowley for mentioning it for investigation.

How were you modifying the udf ?|||You must have been modifying the create script version of the udf that included a drop as illustrated by brett. alter function perserves the permissions.|||Originally posted by rnealejr
You must have been modifying the create script version of the udf that included a drop as illustrated by brett. alter function perserves the permissions.

Yes, I am using the create script version of the udf. But it does not include a drop. Here is what my udf looks like:

---
CREATE FUNCTION UFName (@.SomeVar int)
RETURNS @.SomeTab TABLE (--some fields)

AS
BEGIN
-- some code ..

RETURN
END
----



--|||If you did not first drop the udf then sql server would raise an error that this object name already existed in the database. If your scripting options are set to remove the referenced object, then you will be dropping/creating the udf. Anyway, in the future use alter function.|||"If you did not first drop the udf then sql server would raise an error that this object name already existed in the database."...unless the modifed script was created by a different login. Check to make sure that you don't have multiple copies of the function.

Also, if you modify the code by opening the UDF directly through Enterprise manager, you will see the code as you presented it, and Enterprise Manager will execute the create statement when you exit and save, but it will also execute a drop beforehand as well as record and reapply any permissions assigned to the function. If you modify the procedure through, say, query analyzer, you have to perform these tasks yourself.

Next time you need to modify it, script the UDF through Enterprise Manager's scripting tool, making sure to check the boxed to include code for dropping and for permissions. Then modify the scripted code and execute it, and then you are back in business.

blindman|||The problem is that multistatement table-valued functions do not behave properly when altered. If you alter a multistatement table-valued function, you will lose the permissions assigned to that udf. When editing a udf in em, you are performing an alter function not create - so the same behavior will occur. For all other udfs, table and scalar - the permissions are not affected.|||That's a new one on me! Gotta try that out.

Any idea why the UDF's would be handled differently than stored procedures?

blindman|||I just ran a test for the situation described, and sure enough, - rnealejr is right!|||Originally posted by Brett Kaiser
Or it's the Miracle thing again....

A sign from Edgar!

I always DROP

Then I get off the floor and order another one...|||rneal,

How did you find this? Is it mentioned in any documentation? It's strange enough the it doesn't apply to scalar functions, but if it only applies to multi-statement table functions and not simple select table functions then that is really odd.

blindman|||I don't think it matters how he found it, the point is it's there and no more ALTER should be done against them until M$ fixes it :)|||It matters to me, how he found it, because if there's some SQL Server documentation from Microsoft that I'm not aware of and that my have information that can help me prevent future problems, then I'd like to see it.

But hey, I'm just like that...|||Originally posted by blindman
It matters to me, how he found it, because if there's some SQL Server documentation from Microsoft that I'm not aware of and that my have information that can help me prevent future problems, then I'd like to see it.

But hey, I'm just like that...

Are you kidding? MS publishing APARS?

Please every "undocumented feature" is found by discovery...there's got to be thousands...|||You contradict yourself again. But if it really matters, follow your own advice, - experiment!

[blinds off]
create function...
go
grant select on...to guest
go
alter function...
go
setuser 'guest'
go
select * from <function>
go
setuser
go
[blinds on]|||You are so clueless, rdjabarov.

[jabbers on]

The idea is to see if there is anything ELSE in the documentation that might be important to know. It's a concept called "being prepared" that persons involved in IT administration have to be aware of. If you want to advance in this field, you need will need to actively seek out new sources of knowledge.

[jabbers off]|||Not again...

It's neither...

MS just doesn't do a good enough job in this area...|||FYI

This is a known bug within sql server and is expected to be corrected with the next release. More microsoft miracles.

Also, as a reminder, lets keep the forum civil - I don't want to have to remove my belt ... :-)|||Originally posted by rnealejr
FYI

This is a known bug within sql server and is expected to be corrected with the next release. More microsoft miracles.

Also, as a reminder, lets keep the forum civil - I don't want to have to remove my belt ... :-)

Well...

if you're gonna play moderator...then who is JonathanB...and why is a web developer moderating a SQL Sever forum?|||And how the H_LL did the Eagles pull that off?|||This is not the first time blindmand is playing ugly. But we're all used to it by now. So we'll just ignore it ... again :)|||As in life, if you think someone is being inappropriate - just ignore it. That will normally take care of it, otherwise affirming the response will just aggravate the situation.

Anyway, more information about the real issue for this post. I just talked to ms and it will be fixed in yukon (not the next sp). Also, I requested that a kb article be created for this bug. If a kb article is entered I will notify dbforums. Also, this bug was reported after sp3 was released.

One item of note is that if you run profiler, you will notice the error:

Error: 208, Severity: 16, State: 1

When you alter a multi-statement udf (this does not appear for the other udfs).|||For the Eagles ... Every game this weekend was awesome. I can not remember a time when so many teams have been so evenly matched.|||Brett - Each forum has moderators. But there are a couple of moderators who span all forums. We have recently had a couple of advertising/spam issues - if you see it, please send me a message. Developer, dba, sa ... Am there, doing it.|||That's sad, especially considering the fact that Beta 1 of Yukon barely has any functional modules, and BOL can hardly be called finished.|||I was disappointed as well since another sp release will probably beat the yukon release. I am more bothered by the fact that they did not submit it as a kb article.|||Originally posted by rnealejr
Brett - Each forum has moderators. But there are a couple of moderators who span all forums. We have recently had a couple of advertising/spam issues - if you see it, please send me a message. Developer, dba, sa ... Am there, doing it.

Hey thanks...

All good games...AND history...

first ever playoff game w/out a punt...

I was hoping for an Indy Packer SB...I still can't believe the Pacl blew it...

should never have gone in to OT...|||When Favre threw that interception in OT, I could have just kicked my tv ... That was the worst decision I have ever seen him make - he might as well just punted the darn ball.|||Originally posted by rnealejr
When Favre threw that interception in OT, I could have just kicked my tv ... That was the worst decision I have ever seen him make - he might as well just punted the darn ball.

You a cheese head?

Where are you from?

Being a Giant Fan (all sympathy cards and wishes welcome) I wanted ANYONE to knock off philly...

Bussy of mine is from cheesland though...looked like he wanted to cry last night...

Hey some good football on tap next weekend...|||No - seeing a great quarterback like Favre throw a ball so recklessly in the air had me befuddled.|||Originally posted by rnealejr
No - seeing a great quarterback like Favre throw a ball so recklessly in the air had me befuddled.

I think the receiver didn't read the blitz...

he was suppose to come off his route...

Still...they were running it down their throat...stick with what works...

But come on 4th and 26?

http://www.nj.com/eagles/times/index.ssf?/base/sports-0/10739020319570.xml|||Playoffs are full of miracles - the immaculate reception, hail mary, the catch ...|||wow, football, men are talking...where the margarita mixer?|||Originally posted by ms_sql_dba
wow, football, men are talking...where the margarita mixer?

Why do I get a specific gender slant?

I know...let's talk about Ice dancing...

How could I create an end user sort report?

Hi all,
I want to create a report that let end user sort the table by click head
of the any column, ascending and descending. How to do that in reporting
service?
My reporting service is in Visual Statdio .Net 2003
Best Regards,
SebastianHi Sebastian
I have not had to do this but would expect that one way would be to:
1) Have the order determined by a hidden parameter (eg intSort = 1
sorts by Name, intSort = 2 sorts by City)
2) use labels for the sort column names using Navigation properties to
call the report again with a parameter indicating the sort required.
I"ve done something similar to allow dynamic grouping
Hope that helps
BrianK
www.bolign.com

Wednesday, March 21, 2012

How come i can't add a domain user?

how come when i try to add a domain user/group i get this error:
Error 15401: Windows NT user or group 'MYDOMAIN\Domain Users' not found.
Check the name again.Hi,
See the reply from Bill from a old postregarding the same issue.
Hi Biva,
I see this is a complex problem as usually the suggestions should work.
The Enterprise Manager will use sp_grantlogin to grant permissions. When we
use sp_grantlogin to grant the permissions to a NT User, the stored
procedure calls
LookupAccountSid function and that function looks in the SID cache on the
local
computer before it goes to a domain controller. If the SID in the cache is
incorrect, then the problem would occur. This problem may occur if we
rename the User account. As far as I know, the only method is to reboot the
computer. However, you may check with Windows 2000 newsgroups for
suggestions, e.g. microsoft.public.win2000.gener­al,
microsoft.public.win2000.activ­e_directory.
In addition, this indicates that domain names are not resolved properly.
Please check in Administators Group in Computer Management. If domains
accounts that are members 'ARE NOT' showing up like this,
domain\account
Instead, they show up as a long string of numbers, then it indicates that
it is not resolved properly. Please check with Windows 2000 newsgroups to
see if they have any suggestions.
This posting is provided "AS IS" with no warranties, and confers no rights.
Regards,
Bill Cheng
Microsoft Support Engineer
Thanks
Hari
"James" <See.My.Sig@.The.Bottom.com> wrote in message
news:s1wIe.13389$Bx5.11303@.trnddc09...
> how come when i try to add a domain user/group i get this error:
> Error 15401: Windows NT user or group 'MYDOMAIN\Domain Users' not found.
> Check the name again.
>
>|||thank you, i found my problem tho, i needed to apply ISA 2004 standard
server's service pack 1. isa doesn't like win2003's sp1... isa's firewall
was stoping rpc.
"Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
news:OTxmREUmFHA.2852@.TK2MSFTNGP15.phx.gbl...
> Hi,
> See the reply from Bill from a old postregarding the same issue.
> Hi Biva,
>
> I see this is a complex problem as usually the suggestions should work.
>
> The Enterprise Manager will use sp_grantlogin to grant permissions. When
> we
> use sp_grantlogin to grant the permissions to a NT User, the stored
> procedure calls
> LookupAccountSid function and that function looks in the SID cache on the
> local
> computer before it goes to a domain controller. If the SID in the cache is
> incorrect, then the problem would occur. This problem may occur if we
> rename the User account. As far as I know, the only method is to reboot
> the
> computer. However, you may check with Windows 2000 newsgroups for
> suggestions, e.g. microsoft.public.win2000.gener­al,
> microsoft.public.win2000.activ­e_directory.
>
> In addition, this indicates that domain names are not resolved properly.
> Please check in Administators Group in Computer Management. If domains
> accounts that are members 'ARE NOT' showing up like this,
> domain\account
>
> Instead, they show up as a long string of numbers, then it indicates that
> it is not resolved properly. Please check with Windows 2000 newsgroups to
> see if they have any suggestions.
>
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>
> Regards,
>
> Bill Cheng
> Microsoft Support Engineer
>
> Thanks
> Hari
> "James" <See.My.Sig@.The.Bottom.com> wrote in message
> news:s1wIe.13389$Bx5.11303@.trnddc09...
>> how come when i try to add a domain user/group i get this error:
>> Error 15401: Windows NT user or group 'MYDOMAIN\Domain Users' not found.
>> Check the name again.
>>
>>
>

How come i can't add a domain user?

how come when i try to add a domain user/group i get this error:
Error 15401: Windows NT user or group 'MYDOMAIN\Domain Users' not found.
Check the name again.Hi,
See the reply from Bill from a old postregarding the same issue.
Hi Biva,
I see this is a complex problem as usually the suggestions should work.
The Enterprise Manager will use sp_grantlogin to grant permissions. When we
use sp_grantlogin to grant the permissions to a NT User, the stored
procedure calls
LookupAccountSid function and that function looks in the SID cache on the
local
computer before it goes to a domain controller. If the SID in the cache is
incorrect, then the problem would occur. This problem may occur if we
rename the User account. As far as I know, the only method is to reboot the
computer. However, you may check with Windows 2000 newsgroups for
suggestions, e.g. microsoft.public.win2000.gener_al,
microsoft.public.win2000.activ_e_directory.
In addition, this indicates that domain names are not resolved properly.
Please check in Administators Group in Computer Management. If domains
accounts that are members 'ARE NOT' showing up like this,
domain\account
Instead, they show up as a long string of numbers, then it indicates that
it is not resolved properly. Please check with Windows 2000 newsgroups to
see if they have any suggestions.
This posting is provided "AS IS" with no warranties, and confers no rights.
Regards,
Bill Cheng
Microsoft Support Engineer
Thanks
Hari
"James" <See.My.Sig@.The.Bottom.com> wrote in message
news:s1wIe.13389$Bx5.11303@.trnddc09...
> how come when i try to add a domain user/group i get this error:
> Error 15401: Windows NT user or group 'MYDOMAIN\Domain Users' not found.
> Check the name again.
>
>|||thank you, i found my problem tho, i needed to apply ISA 2004 standard
server's service pack 1. ISA doesn't like win2003's sp1... isa's firewall
was stoping rpc.
"Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
news:OTxmREUmFHA.2852@.TK2MSFTNGP15.phx.gbl...
> Hi,
> See the reply from Bill from a old postregarding the same issue.
> Hi Biva,
>
> I see this is a complex problem as usually the suggestions should work.
>
> The Enterprise Manager will use sp_grantlogin to grant permissions. When
> we
> use sp_grantlogin to grant the permissions to a NT User, the stored
> procedure calls
> LookupAccountSid function and that function looks in the SID cache on the
> local
> computer before it goes to a domain controller. If the SID in the cache is
> incorrect, then the problem would occur. This problem may occur if we
> rename the User account. As far as I know, the only method is to reboot
> the
> computer. However, you may check with Windows 2000 newsgroups for
> suggestions, e.g. microsoft.public.win2000.gener_al,
> microsoft.public.win2000.activ_e_directory.
>
> In addition, this indicates that domain names are not resolved properly.
> Please check in Administators Group in Computer Management. If domains
> accounts that are members 'ARE NOT' showing up like this,
> domain\account
>
> Instead, they show up as a long string of numbers, then it indicates that
> it is not resolved properly. Please check with Windows 2000 newsgroups to
> see if they have any suggestions.
>
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>
> Regards,
>
> Bill Cheng
> Microsoft Support Engineer
>
> Thanks
> Hari
> "James" <See.My.Sig@.The.Bottom.com> wrote in message
> news:s1wIe.13389$Bx5.11303@.trnddc09...
>

How come i can't add a domain user?

how come when i try to add a domain user/group i get this error:
Error 15401: Windows NT user or group 'MYDOMAIN\Domain Users' not found.
Check the name again.
Hi,
See the reply from Bill from a old postregarding the same issue.
Hi Biva,
I see this is a complex problem as usually the suggestions should work.
The Enterprise Manager will use sp_grantlogin to grant permissions. When we
use sp_grantlogin to grant the permissions to a NT User, the stored
procedure calls
LookupAccountSid function and that function looks in the SID cache on the
local
computer before it goes to a domain controller. If the SID in the cache is
incorrect, then the problem would occur. This problem may occur if we
rename the User account. As far as I know, the only method is to reboot the
computer. However, you may check with Windows 2000 newsgroups for
suggestions, e.g. microsoft.public.win2000.generXal,
microsoft.public.win2000.activXe_directory.
In addition, this indicates that domain names are not resolved properly.
Please check in Administators Group in Computer Management. If domains
accounts that are members 'ARE NOT' showing up like this,
domain\account
Instead, they show up as a long string of numbers, then it indicates that
it is not resolved properly. Please check with Windows 2000 newsgroups to
see if they have any suggestions.
This posting is provided "AS IS" with no warranties, and confers no rights.
Regards,
Bill Cheng
Microsoft Support Engineer
Thanks
Hari
"James" <See.My.Sig@.The.Bottom.com> wrote in message
news:s1wIe.13389$Bx5.11303@.trnddc09...
> how come when i try to add a domain user/group i get this error:
> Error 15401: Windows NT user or group 'MYDOMAIN\Domain Users' not found.
> Check the name again.
>
>
|||thank you, i found my problem tho, i needed to apply ISA 2004 standard
server's service pack 1. isa doesn't like win2003's sp1... isa's firewall
was stoping rpc.
"Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
news:OTxmREUmFHA.2852@.TK2MSFTNGP15.phx.gbl...
> Hi,
> See the reply from Bill from a old postregarding the same issue.
> Hi Biva,
>
> I see this is a complex problem as usually the suggestions should work.
>
> The Enterprise Manager will use sp_grantlogin to grant permissions. When
> we
> use sp_grantlogin to grant the permissions to a NT User, the stored
> procedure calls
> LookupAccountSid function and that function looks in the SID cache on the
> local
> computer before it goes to a domain controller. If the SID in the cache is
> incorrect, then the problem would occur. This problem may occur if we
> rename the User account. As far as I know, the only method is to reboot
> the
> computer. However, you may check with Windows 2000 newsgroups for
> suggestions, e.g. microsoft.public.win2000.generXal,
> microsoft.public.win2000.activXe_directory.
>
> In addition, this indicates that domain names are not resolved properly.
> Please check in Administators Group in Computer Management. If domains
> accounts that are members 'ARE NOT' showing up like this,
> domain\account
>
> Instead, they show up as a long string of numbers, then it indicates that
> it is not resolved properly. Please check with Windows 2000 newsgroups to
> see if they have any suggestions.
>
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>
> Regards,
>
> Bill Cheng
> Microsoft Support Engineer
>
> Thanks
> Hari
> "James" <See.My.Sig@.The.Bottom.com> wrote in message
> news:s1wIe.13389$Bx5.11303@.trnddc09...
>

How check user name?

I have COM object working with database via connection with administrative
rights.
I need method for checking user name: can this user has db access or no.
I want to check:
1. SQL Server users
2. Windows users which added as a SQL Server logins/db users
3. Windows users which can connect to db as a members of windows groups
added to SQL Server.
Thnx.have you looked into using SQL-DMO. The object model has collections and
methods to do all you ask.
regards,
Mark Baekdal
MSN m_baekdal@.hotmail.com
+44 (0)141 416 1490
+44 (0)208 241 1762
http://www.dbghost.com
http://www.innovartis.co.uk
Build, Comparison and Synchronization from Source Control = Database change
management for SQL Server
"Oleg Cherkasenko" wrote:

> I have COM object working with database via connection with administrative
> rights.
> I need method for checking user name: can this user has db access or no.
> I want to check:
> 1. SQL Server users
> 2. Windows users which added as a SQL Server logins/db users
> 3. Windows users which can connect to db as a members of windows groups
> added to SQL Server.
> Thnx.
>
>sql

How check database properties?

Hello, Everyone:
There are some databases in a SQL Server. How to check,
1. User database numbers
2. Backup plan
3. Configuration
4. User database size
5. Nightly process
Thanks a lot
ZYTsp_helpdb <DBname> should give you a broad overview of the database.

For the rest of the stuff you can use Enterprise Manager.sql