Solved

uniqueidentifier data type in MS SQL 2005

Posted on 2008-06-22
1
2,590 Views
Last Modified: 2010-05-18
I'm using MS SQL Server 2005 Management Studio Express to create a simple database that will manage customer-specific PDF documents that customers will have access to on the company website. The files will be stored on the server's file system and this database will just manage the links to those documents. I'm building this with MS Visual Studio Web Developer 2008 Express Edition. I'm just building a sample site on my local drive; not production at this point.

If I use the uniqueidentifier data type in a table, how is that unique identifier number generated? Do I have to manually generate it in code when I add an item to that table or is this a GUID that the system generates automatically? Thanks.
0
Comment
Question by:WineGeek
1 Comment
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 21841980
>Do I have to manually generate it in code
yes/no.

let me explain:
no -> you could use the newid() function as default.

however, if you want to retrieve/know the generated value, it will be better if you generate it in your (sql) code for the insert, and return it back to the application code.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Choosing SSD drives for SQL Server 32 80
c# code 19 59
Ranking Based On Value 3 29
sql server query? 6 28
Nowadays, some of developer are too much worried about data. Who is using data, who is updating it etc. etc. Because, data is more costlier in term of money and information. So security of data is focusing concern in days. Lets' understand the Au…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now