Solved

uniqueidentifier data type in MS SQL 2005

Posted on 2008-06-22
1
2,592 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Help with SQL Server Stoplist 2 22
MS SQL Pivot table help 4 17
SSRS troubles 4 23
sql server group by every 2hrs 5 21
Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.

864 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

18 Experts available now in Live!

Get 1:1 Help Now