What query should I run?
1. To determine whether a column is a rowguid or not using C# .NET 1.1
2. To add/modify column information and be able to set/change:
- Primary key
- Column Name
- Data Type
- Length
- Allow Null
- Default value
- Precision
- Scale
- Identity
- Identity Seed
- Identity Increment
- Row guid
Thanks a lot!
(1) SELECT OBJECTPROPRTTY(<tableId>,TableHasRowGuidCol) will tell you if the table has uniqueidentifier column.
(2) Please refer BOL.
|||Hi, thanks for the answer but I tried to run this:
SELECT
OBJECTPROPERTY(OBJECT_ID('temp_aspnet_Permissions'),TableHasRowGuidCol)
and it gives me error:
Msg 207, Level 16, State 1, Line 1
Invalid column name 'TableHasRowGuidCol'.
|||Never mind, I forgot about the quote:
SELECT
OBJECTPROPERTY(OBJECT_ID('temp_aspnet_Permissions'),'TableHasRowGuidCol')Thanks again!
|||Btw, it only returning number 1 or 0, I need to know which column that has rowguid, so it still hasn't answer my question :(|||I found it, you need to use columnproperty. Thanks again for the guidance!
SELECTCOLUMNPROPERTY(OBJECT_ID('testcol2'),'col2','IsRowGuidCol')
|||SELECT
COLUMNPROPERTY(id,name,'IsRowGuidCol'),*FROMsyscolumnsWHEREid=Object_Id('yourtable')
andCOLUMNPROPERTY(id,name,'IsRowGuidCol') = 1
No comments:
Post a Comment