Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Getting a new GUID from a table...

Author  Topic 

huge
Starting Member

31 Posts

Posted - 2001-07-30 : 11:54:19
Ok i have a table that looks like this

-------------
SessionLog
-------------
SID - UniqueIdentifier Default (NewID()) (PK)
UserID - Null Values allowed

Ok now I have an ASP page that goes into this table and grabs a new SID number from a Stored Proc. So what this will do is every person, session that visits the site will get a new SID and when they login with username and password (in another table) it will put their userid into this SessionLog table under the SID (that will be in their querystring).

So this is what I did:

CREATE PROCEDURE sproc_getSID
AS
DECLARE @newid uniqueidentifier
SET @newid = NewID()
RETURN (@newid)
INSERT SessionLog (SID)
values (@newid)
GO

THis attempts to get a value for a uniqueidentifier place it into a variable which then gets inserted into a table, then returns the value of the variable to the ASP page.

However I keep getting this error:
Error 206: Operand Type Clash: uniqueidentifier is incompatible with int

whats wrong here?

Thanks
Mike


   

- Advertisement -