SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 how to generate guid in sql server
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

pujitha
Starting Member

1 Posts

Posted - 06/11/2008 :  00:06:18  Show Profile  Reply with Quote
Dear Expert,
Iam new to sql server2000

I have table Table1 in that table I want to generate unique guid in one column.I want the code for that one kindly help me.

visakh16
Very Important crosS Applying yaK Herder

India
52325 Posts

Posted - 06/11/2008 :  00:14:04  Show Profile  Reply with Quote
use NEWID() function to create unique guid and amke a default for column on it

CREATE TABLE
(uidCol uniqueidentifier DEFAULT NEWID(),
...)
Go to Top of Page

sunsanvin
Flowing Fount of Yak Knowledge

India
1274 Posts

Posted - 06/11/2008 :  00:41:41  Show Profile  Send sunsanvin a Yahoo! Message  Reply with Quote
Dear Puji,
use like this
select newid()
go
that will give you a newid. so copy that and paste.
vinod

Arnav
Even you learn 1%, Learn it with 100% confidence.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.16 seconds. Powered By: Snitz Forums 2000