Showing posts with label hican. Show all posts
Showing posts with label hican. Show all posts

Friday, March 23, 2012

How to change identity to an existing column?

Hi

can anybody tell , Is it possible to alter existing column to add IDENTITY?

Thanks in advance

Yes

It is possible to add Identity Column to a table already have some data. BUT there is no such a command to alter a column to be an IDENTITY Column. You have to go through the following steps.

1. Create a same table with the IDENTITY COLUMN. but with diffrent Name
2. Move all data to the New Table, with IDENTITY INSERT ON option
3. Drop All constraints from the OLD table
4. Drop the OLD table
5. Rename the new table as the OLD table
6. Attach all constraints to the new table ...

Hope that it will help

|||Thank u akbar

Monday, March 12, 2012

How to capture the sql query

Hi
can someone explain how the profiler get the queries that are fired against the database. This information will be useful for building a customized trace tool.
ThanksRefer to Inside SQL Server book from Kalen Daleney and also you may get better information from MS Support about designing such a tool.

HTH|||look at the sp_trace_xxxxxx stored procedures