Saturday, February 25, 2012

Add IDENTITY column in runtime in a View...

Dear All,
I'm facing a problem with creating a view.I have a table with
following description

Tab1
-----------
Col1 col2
-- --
Val1 Tom
Val2 Cat
Val3 Jack
Val4 Jim

Now I'm trying to create a view with following information from
Tab1.The output should be

Tab1View
------------
Col1 Col2 Col3
-- -- --
1 Val1 Tom
2 Val2 Cat
3 Val3 Jack
4 Val4 Jim
------------
So the create view statement add this column dynamically in this
result set.
If any body has any doubt on this query please let me inform.
Regards
Arijit Chatterjeearijitchatterjee123@.yahoo.co.in (Arijit Chatterjee) wrote in message news:<ea01504d.0308032036.206a7354@.posting.google.com>...
> Dear All,
> I'm facing a problem with creating a view.I have a table with
> following description
> Tab1
> -----------
> Col1 col2
> -- --
> Val1 Tom
> Val2 Cat
> Val3 Jack
> Val4 Jim
> Now I'm trying to create a view with following information from
> Tab1.The output should be
> Tab1View
> ------------
> Col1 Col2 Col3
> -- -- --
> 1 Val1 Tom
> 2 Val2 Cat
> 3 Val3 Jack
> 4 Val4 Jim
> ------------
> So the create view statement add this column dynamically in this
> result set.
> If any body has any doubt on this query please let me inform.
> Regards
> Arijit Chatterjee

Here is a Microsoft KB article which describes various options:

http://support.microsoft.com/defaul...kb;en-us;186133

Alternatively, you might find it easier and more efficient to add the
row numbers in the client application.

Simon

No comments:

Post a Comment