[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 312
  • Last Modified:

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
0
Autoeforms
Asked:
Autoeforms
1 Solution
 
ColosseoCommented:
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
0
 
BillAn1Commented:
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.
0
 
nmcdermaidCommented:
What if you put square brackets around the name if the 'ID' field?


create table Member([ID] int identity(1,1) not null, Email varchar(255) not null)
0
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

 
Eugene ZCommented:


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)
0
 
Eugene ZCommented:
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)
0
 
AutoeformsAuthor Commented:
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
0
 
nmcdermaidCommented:
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.
0
 
rafranciscoCommented:
Please post the part in your VB.NET application that sends the command to SQL Server.
0
 
GregWeberCommented:
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
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now