Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
esthera
Master Smack Fu Yak Hacker
1410 Posts |
Posted - 2013-11-03 : 10:13:03
|
how can I craeat an identity field on a temporary tablebelow didn't workdeclare @t table ( RowNum int IDENTITY(1,1),code nvarchar(10),matchcount int,name nvarchar(50),laststatus nvarchar(10),city nvarchar(10),mydate datetime,imagefile nvarchar(50),ispaid bit) |
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2013-11-03 : 10:29:33
|
quote: Originally posted by esthera how can I craeat an identity field on a temporary tablebelow didn't workdeclare @t table ( RowNum int IDENTITY(1,1),code nvarchar(10),matchcount int,name nvarchar(50),laststatus nvarchar(10),city nvarchar(10),mydate datetime,imagefile nvarchar(50),ispaid bit)
The syntax is the table variable name followed by the keyword table, as indeclare @t table ( X int IDENTITY(1,1),code nvarchar(10),.... By the way, this is a TABLE VARIABLE rather than a temp table. A temp table is the one whose name starts with a # or ##. They can be used for similar purposes, but there are very significant differences between a table variable and a temp table. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-11-03 : 14:27:23
|
quote: Originally posted by esthera how can I craeat an identity field on a temporary tablebelow didn't workdeclare @t table ( RowNum int IDENTITY(1,1),code nvarchar(10),matchcount int,name nvarchar(50),laststatus nvarchar(10),city nvarchar(10),mydate datetime,imagefile nvarchar(50),ispaid bit)
cant find any obvious errors with sybtax. what was the error you got?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
|
|
|
|
|