What Is It Mean That User_name Is A Sysname?

Apr 25, 2007

Hi,



In SQL Server 2005 Express BOL,

it says in 'Arguments' description part like this.



user_name

Specifies the name by which the user is identified inside this database. user_name is a sysname.
It can be up to 128 characters long.



What 'user_name is a sysname' imply?

View 2 Replies


ADVERTISEMENT

Sysname

Jan 6, 2008

Hi ALL,
What does "sysname" type indicates. 
 
 
USE <database, sysname, AdventureWorks>
GO
IF OBJECT_ID('<schema_name, sysname, dbo>.<table_name, sysname, sample_table>', 'U') IS NOT NULL
DROP TABLE <schema_name, sysname, dbo>.<table_name, sysname, sample_table>
GOCREATE TABLE <schema_name, sysname, dbo>.<table_name, sysname, sample_table>
(<columns_in_primary_key, , c1> <column1_datatype, , int> <column1_nullability,, NOT NULL>,
<column2_name, sysname, c2> <column2_datatype, , char(10)> <column2_nullability,, NULL>, <column3_name, sysname, c3> <column3_datatype, , datetime> <column3_nullability,, NULL>,
CONSTRAINT <contraint_name, sysname, PK_sample_table> PRIMARY KEY (<columns_in_primary_key, , c1>)
)
GO

View 1 Replies View Related

What Is Sysname?

Oct 23, 2006

USE <database, sysname, AdventureWorks>

What is "sysname" object? I frequently see it among parameters for stored procedures.

Thanks.

View 16 Replies View Related

Newbee Q: What Is Sysname?

Feb 12, 2003

Hi.

I`m new to MS Sql and have been studying some tutorials and stuff.

What I can`t get a hold of is this sysname-thing. I see it is referenced to when i.e you create a new table...


Can anyone help me?

Freddy....

View 1 Replies View Related

How To Get HOST_NAME Insted Of User_name()

Jun 7, 2001

All developers use same login to access database (I know is it is not the best solution)

We need track when user insert value or edit value in specific table
It is done by triger and work fine with USER_ID() or user_name()

But all users (developers) use same login and USER_ID() and user_name()always the same.

Please help me how can get HOST_NAME of user who is trying to modify table and place it into triger insted of user_name()

Thanks a lot

View 2 Replies View Related

Collation Conflict On Sysname?? Really?

Nov 9, 2006

Okely dokely, here it is.I have a database that has a differing collation to that of the tempdb. And obviously because of this I've run into problems when referencing table variables and temp tables. BUT! Given the following example, what am I doing wrong, or is there no solution to this. <Start Example>/*================================================= ================================================== ==========================fnPM_ForeignKey ================================================== ================================================== =========================*/IF exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[fnPM_ForeignKey]')) BEGINDROP FUNCTION [dbo].[fnPM_ForeignKey]ENDGOCREATE FUNCTION fnPM_ForeignKey (@ChildTable as sysname, @ChildColumn as sysname)RETURNS @ForeignKey TABLE (FKName sysname,ParentTable sysname,ParentColumn sysname,DescriptionColumn sysname COLLATE SQL_Latin1_General_CP1_CI_AS)ASBEGININSERT INTO @ForeignKey (FKName, ParentTable, ParentColumn)SELECT FK.Name, Parent.Name, ParentCol.NameFROM sysforeignkeysINNER JOIN sysobjects FK on sysforeignkeys.constid = FK.IDINNER JOIN sysobjects Parent on sysforeignkeys.rkeyid = Parent.idINNER JOIN syscolumns ParentCol on ParentCol.id = Parent.id and sysforeignkeys.rkey = ParentCol.colidINNER JOIN sysobjects Child on sysforeignkeys.fkeyid = Child.idINNER JOIN syscolumns ChildCol on ChildCol.id = Child.id and sysforeignkeys.fkey = ChildCol.colid WHERE Child.Name = @ChildTable and ChildCol.Name = @ChildColumn--> UPDATE @ForeignKey Set DescriptionColumn = syscolumns.Name COLLATE SQL_Latin1_General_CP1_CI_ASFROM @ForeignKey ForeignKeyINNER JOIN sysobjects on ForeignKey.ParentTable = sysobjects.NameINNER JOIN syscolumns on syscolumns.id = sysobjects.idWHERE syscolumns.Name like '%Name%'UPDATE @ForeignKey Set DescriptionColumn = syscolumns.NameFROM @ForeignKey ForeignKeyINNER JOIN sysobjects on ForeignKey.ParentTable = sysobjects.NameINNER JOIN syscolumns on syscolumns.id = sysobjects.idWHERE ForeignKey.DescriptionColumn is null and syscolumns.Name like '%Description%'RETURN ENDGO< end example >So here I'm defining my function which basically returns the parent table details of a given foreign key relationship. But when trying to run the above script I get this,Server: Msg 446, Level 16, State 9, Procedure fnPM_ForeignKey, Line 22Cannot resolve collation conflict for equal to operation.First up I find this weird because isn't sysname equvalent to nvarchar(128)? And aren't nvarchar fields independant of collation? But it gets better,I thought, ok maybe I'm wrong about sysname needing collation, so I figured I'll check the collation of the syscolumns.name column,Heres the queryselect sysobjects.Name, syscolumns.name, syscolumns.collationfrom sysobjects inner join syscolumns on sysobjects.id = syscolumns.idwhere sysobjects.name ='syscolumns' and syscolumns.name = 'name'This is what it returns,syscolumnsnameSQL_Latin1_General_CP1_CI_ASSo, let me get this straight, I've explicitly stated that the table variable column is collation SQL_Latin1_General_CP1_CI_ASand the column I'm comparing it to also has a collation of SQL_Latin1_General_CP1_CI_AS, and it doesn't work. . . .I smell Microsoft, or is there something equally as hideous going on here.RegardsAdam.

View 1 Replies View Related

Declaring USER_NAME() As SQL Variable

Jul 20, 2005

Hi,I have a User-defined function "Concatenate_NoteTexts" which I use in aquery (SQL Server 2000). On my local development machine it is called likethis:SELECTdbo.Concatenate_NoteTexts(Introducers.IntroducerID ) as NoteTextsFROM tblIntroducersI want to run the same code on a shared remote server where I am user "JON"instead of "dbo". I don't want to hard-code the User Name into the SQL, butwhen I tried to put the user name into a variable as here:DECLARE @USER_NAME VarChar(30)SET @USER_NAME = USER_NAME()SELECT@USER_NAME.Concatenate_NoteTexts(Introducers.Intro ducerID) as NoteTextsFROM tblIntroducersI get the following error:Server: Msg 170, Level 15, State 1, Line 4Line 4: Incorrect syntax near '.'Any advice?TIA,JONPS First posted earlier today to AspMessageBoard - no answers yet.http://www.aspmessageboard.com/foru...=626289&F=21&P=1

View 5 Replies View Related

Procedure 'JaiDeleteUser' Expects Parameter '@user_name', Which Was Not Supplied

Feb 10, 2008

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server"><title>Untitled Page</title> </head>
<body>
 
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
 
<div>
 
<br />
<asp:Label ID="lblUserInfo" runat="server" Text="Label"></asp:Label><asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:JaiConnectionString %>" DeleteCommand="JaiDeleteUser" DeleteCommandType="StoredProcedure" SelectCommand="SELECT users.user_name, users.user_pass, user_roles.role_name, users.VendorId FROM users INNER JOIN user_roles ON users.user_name = user_roles.user_name"
UpdateCommand="JaiUpdateUser" UpdateCommandType="StoredProcedure">
<DeleteParameters>
<asp:Parameter Name="user_name" Type="String" />
<asp:Parameter Name="user_pass" Type="String" />
<asp:Parameter Name="role_name" Type="String" />
<asp:Parameter Name="VendorId" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="user_name" Type="String" />
<asp:Parameter Name="user_pass" Type="String" />
<asp:Parameter Name="role_name" Type="String" />
<asp:Parameter Name="VendorId" Type="Int32" />
</UpdateParameters>
</asp:SqlDataSource><asp:GridView ID="GridView1" runat="server" AllowSorting="True"
AutoGenerateColumns="False" DataSourceID="SqlDataSource1">
<Columns>
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" /><asp:BoundField DataField="user_name" HeaderText="user_name"
SortExpression="user_name" /><asp:BoundField DataField="user_pass" HeaderText="user_pass"
SortExpression="user_pass" /><asp:BoundField DataField="role_name" HeaderText="role_name"
SortExpression="role_name" /><asp:BoundField DataField="VendorId" HeaderText="VendorId"
SortExpression="VendorId" />
</Columns>
</asp:GridView>
<br />
<br />
</div></form> </body>
</html>
 
 
<<<<<<<<<<<<<Stored Procedure>>>>>>>>>>>>>>>>
CREATE PROCEDURE [dbo].[JaiDeleteUser] @user_name varchar (25), @user_pass varchar (25), @role_name Varchar (15), @VendorId intAS
beginDelete from user_roles where user_name =@user_nameDELETE FROM [users] WHERE user_name =@user_nameendGO
I am getting the error
Procedure 'JaiDeleteUser' expects parameter '@user_name', which was not supplied
whenever I try to delete a record. While Updating works with no problem. Please help.

View 8 Replies View Related

Login Failed For User &&<user_name&&>. (Microsoft SQL Server, Error: 18456)

Aug 25, 2007

Please help I keep getting this message when I log on to my data base. Not sure what state 1 relates too

TITLE: Connect to Server
------------------------------
Cannot connect to <server_name>
------------------------------
ADDITIONAL INFORMATION:
Login failed for user <user_name>. (Microsoft SQL Server, Error: 18456)

------------------------------
BUTTONS:
OK
------------------------------
Server Name: <server~name>Error Number: 18456
Severity: 14
State: 1
Line Number: 65536

View 13 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved