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
 MySQL -> SQL

Author  Topic 

abundant_lyfe
Starting Member

10 Posts

Posted - 2007-02-19 : 12:54:25
Can anybody see what is wrong with this?

create table transaction
(txn_id int not null IDENTITY(1,1),
txn_date datetime not null,
account_id int not null,
/*txn_type_cd enum('DBT','CDT')*/check(txn_type_cd('DBT','CDT')),
amount double(10,2) not null,
teller_emp_id smallint ,
execution_branch_id smallint ,
funds_avail_date datetime,
constraint fk_t_account_id foreign key (account_id)
references account (account_id),
constraint fk_teller_emp_id foreign key (teller_emp_id)
references employee (emp_id),
constraint fk_exec_branch_id foreign key (execution_branch_id)
references branch (branch_id),
constraint pk_transaction primary key (txn_id)

I'm getting an error when I try and run in, but I can't see what it is!

Incorrect syntax near the keyword 'transaction'.

The code has been generated as mysql, and I am attempting to change it to SQL.

Thank you!

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-02-19 : 12:56:06
Transaction is a reserved word. Enclose it within bracket, [transactions].


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-02-19 : 12:57:09
Probably that "transaction" is a reserved word.

Put [transaction] around it ??

Kristen
Go to Top of Page

abundant_lyfe
Starting Member

10 Posts

Posted - 2007-02-19 : 12:58:38
Fantastic. Thank you
Go to Top of Page
   

- Advertisement -