Link to home
Start Free TrialLog in
Avatar of Autoeforms
Autoeforms

asked on

Create SQL Syntax for table with identity field getting error parameter is incorrect

i have the database schema and have code to create the databases on the fly.
i have everything working but for the life of me can't get the identity field to create.
please help

I am trying to run the following command.

create table Member(ID integer identity, Email varchar(255) not null)

i continue to get the error parameter is incorrect

also tried
create table Member(ID integer identity(1,1) not null, Email varchar(255) not null)


have also tried

alter table member add field Id integer identity.

i am at a lost. everything i read says this should work
Avatar of Colosseo
Colosseo
Flag of United Kingdom of Great Britain and Northern Ireland image

Hi

does this work specifying int rather than integer

create table Member(ID int identity(1,1) not null, Email varchar(255) not null)

apart from that it looks fine

Scott
Avatar of BillAn1
BillAn1

can you give the exact error message you are getting (and also how are you running the command - are you running as part of a script in QA?)
both of the create scripts you gave above work fine for me.
ASKER CERTIFIED SOLUTION
Avatar of nmcdermaid
nmcdermaid

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of EugeneZ


in QA click CTRL+N
copy\paste there

UISE yourDBname
go
drop table Member
create table Member(ID integer identity(1,1) not null, Email varchar(255) not null)
typo:
in QA click CTRL+N
copy\paste there

USE yourDBname
go
drop table Member
create table Member(ID integer identity(1,1) not null, Email varchar(255) not null)
Avatar of Autoeforms

ASKER

Still Not good.

I tried the the create statement on the table

the program throws an error in a message box "The Parameter Is InCorrect"

I have a vb.net program with a sql statement trying the command i get the message back in error text

I copied the text and tried it from a stored procedure in access with the same result.

still
Try it in Query Analyzer. That will verify wether the SQL is correct and you can work your way back up to find out at which level the error is occuring.
Please post the part in your VB.NET application that sends the command to SQL Server.
thanks
i took the example from above and started from scratch and everything worked.
the command still does not work in access but at this point that was not my concern

cheers