Click here to Skip to main content
15,888,250 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
query as follows;
SQL
declare #TempTable(SNo int, Stud_ID varchar(10), Stud_Name varchar(100),
      Rcptno varchar(20),Rcptdt varchar(20), RcptAmt varchar(20),Chqtype varchar(20))


But when i run the above query, error shows as follows;

Incorrect syntax near '('.


i think my query is correct but when i run error shows.


what is the problem in my above code.

Please help me.

Regards,
Narasiman P.
Posted
Updated 17-Apr-13 19:38pm
v2

Using TABLE after declare #TempTable should also work
SQL
declare #TempTable Table(SNo int, Stud_ID varchar(10), Stud_Name varchar(100),
Rcptno varchar(20),Rcptdt varchar(20), RcptAmt varchar(20),Chqtype varchar(20))
 
Share this answer
 
Comments
Aarti Meswania 18-Apr-13 0:48am    
5+! :)
Abhinav S 18-Apr-13 2:29am    
Thank you.
Aarti Meswania 18-Apr-13 2:30am    
Welcome! :)
hi,

Use something like this, For creating temporary table...

SQL
create table #temUsers            
(            
MyContactUserID uniqueidentifier,            
MyContactName varchar(200),            
HisContactUserID uniqueidentifier,            
HisContactName varchar(200),            
ConnectionDate datetime          
)
 
Share this answer
 
v3
hi,

use

SQL
create Table #tempTable(SNo int, Stud_ID varchar(10), Stud_Name varchar(100),
    Rcptno varchar(20),Rcptdt varchar(20), RcptAmt varchar(20),Chqtype varchar(20))
 
Share this answer
 
SQL
-- if want to create Temp table then
create table  ##TempTable
(SNo int, Stud_ID varchar(10), Stud_Name varchar(100),
        Rcptno varchar(20),Rcptdt varchar(20), RcptAmt varchar(20),Chqtype varchar(20))

--if you want to use Table Varriable

declare @TempTable Table(SNo int, Stud_ID varchar(10), Stud_Name varchar(100),
Rcptno varchar(20),Rcptdt varchar(20), RcptAmt varchar(20),Chqtype varchar(20))
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900