Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Creating Table

Author  Topic 

abuhassan

105 Posts

Posted - 2006-07-27 : 07:23:25
Hi

I am trying to create a table in sql server 2000 and seem to be getting an error

the code that i am using is as folows:


CREATE TABLE Invoice
(
InvoiceID INT IDENTITY PRIMARY KEY NOT NULL Auto_Increment,
Invoice_no VARCHAR(50),
RefText VARCHAR(50),
CustomerDetails text,
)


I want to be able to have the invoiceid as the primary key that auto increments...

After creating the table id like to import a csv file with only the following data

Invoice_no, RefText, CustomerDetails

is it possible to do this as i want the id to automatically be generated to be unique


thanks

Lumbago
Norsk Yak Master

3271 Posts

Posted - 2006-07-27 : 07:45:44
Change the InvoiceID definition to this and you should be fine:

InvoiceID INT IDENTITY (1, 1) PRIMARY KEY NOT NULL,

--
Lumbago
"Real programmers don't document, if it was hard to write it should be hard to understand"
Go to Top of Page

abuhassan

105 Posts

Posted - 2006-07-27 : 07:53:08
thanks
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-07-27 : 08:25:19
Also read about Create Table in sql server help file for more information

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

abuhassan

105 Posts

Posted - 2006-07-27 : 09:05:41
thanks

i was a bit confused i think mysql doesnt use the same sql as sql server 2000
Go to Top of Page

Srinika
Master Smack Fu Yak Hacker

1378 Posts

Posted - 2006-07-27 : 09:13:43
Any Database MySQL (or even yourSQL ) has both standard SQL and its own (enhanced) SQL.
eg. MS SQL server has T-SQL, Oracle has PL-SQL.




Srinika
Go to Top of Page

abuhassan

105 Posts

Posted - 2006-07-27 : 09:26:18
Thanks for the calrification.....

Go to Top of Page
   

- Advertisement -