Showing posts with label newid(). Show all posts
Showing posts with label newid(). Show all posts

Friday, 17 June 2011

SQL Server: use the NewId() function to create unique identifiers

   


A few months ago, I have published an article mentioning the NewId() SQL function. In that post, I was explaining how to create dynamic keywords and description meta tags. However the NewId() function can be used in different situations and it becomes very handy, when we need unique identifiers.
Let's see how it works.

The basics
The NewId() function returns a unique identifier; that means a unique set of numbers and letters. If we use the function in a query in SQL Server Management Studio like:
print newid()
the result will be a unique identifier like:
5C6C9372-49F9-4A5C-BCFA-DA6CDB525CAB
Interestingly enough, the above result is unique and can be used in various way. For example, we can use the function to generate personal identification numbers (PINs), login passwords, ids, serial numbers or product keys, simple primary keys etc. At the same time we can use the function to create random sorting of data.

Friday, 10 September 2010

Dynamic keywords and description meta tags

   


After publishing the "Are keywords and description attributes useful?" post, I will explain how to create dynamic keywords and description meta tags. If you have a dynamic page which, for example, retrieves records from a table, according to query parameters, it is quite easy to populate the meta tags with relevant keywords or a description strictly related to the recordset itself.