Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Create Table syntax
Message
 
 
To
04/06/2012 10:47:23
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2008
Application:
Desktop
Miscellaneous
Thread ID:
01545225
Message ID:
01545228
Views:
44
This message has been marked as a message which has helped to the initial question of the thread.
>Hello all
>
>ok, it's been a while since I had to deal with straight T-SQL and I'm trying to create a table
>
>Create table CATMaster (CATID int identity(1,1), Category varchar(2), diff varchar(1), ALC varchar(5), Keyword varchar(25),
> Keyword2 Varchar(25), keyopt varchar(1), script varchar(500), stem varchar(500), respa varchar(115),
> respb varchar(115),respc varchar(115), respd varchar(115), scripttime varchar(2), testtype varchar(1),
> EntBy VarChar(3), EntDate date, RevBy Varchar(3), RevDate date, Completed varchar(1)
>
>It keeps telling me "The specified data type is not valid. [ Data type (if known) = varchar ]"
>
>Ok, I'm confused. What am I not seeing?
>
>Thanks

You're missing last ). Also, there is no point of creating varchar(1) fields. CHAR(1) are better for this case (I actually start creating varchar from 5 and up). So, I would write the above as
Create table CATMaster (CATID int identity(1,1), Category char(2), [diff] char(1), ALC varchar(5), Keyword varchar(25),
  Keyword2 Varchar(25), keyopt char(1), script varchar(500), stem varchar(500), respa varchar(115),
  respb varchar(115),respc varchar(115), respd varchar(115), scripttime char(2), testtype char(1), 
  EntBy Char(3), EntDate date, RevBy char(3), RevDate date, Completed char(1))
Also, are you using SQL 2008?
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform