Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Create Table syntax
Message
 
 
À
04/06/2012 10:47:23
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2008
Application:
Desktop
Divers
Thread ID:
01545225
Message ID:
01545228
Vues:
45
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform