Page 1 of 1
TSQL Scripts
Posted: Mon May 17, 2004 6:02 pm
by tony.malandain
Hi,
I'm trying to write a small SQL Script to run using TSQL -i <scriptName>
I'd like to add some comments in the script but so far I've been unable to find the right syntax.
I tried the /* */, //, #, ' and others, but no luck.
Does TSQL support comments in the scripts?
Thanks,
/Tony.
TSQL Scripts
Posted: Mon May 17, 2004 6:15 pm
by mark
Standard sql comments are double dash:
--
Note that using comments will prevent row output from select statements unless you use tsql -v .
TSQL Scripts
Posted: Mon May 17, 2004 7:49 pm
by tony.malandain
Thanks Mark.
I'm so used to MS SQL that I didn't even know the double dash was the standard.
One more question about my script: I'm trying to set a foreign key reference between 2 tables.
I have
CREATE TABLE A
(
fieldA
CHAR(40)
NOT NULL
PRIMARY KEY
);
CREATE TABLE B
(
fieldB
INTEGER
NOT NULL,
refA
CHAR(40)
NOT NULL
REFERENCES A(fieldA)
);
But if I execute:
insert into B values (4, 'xxx');
an entry gets created where I was expecting Texis to throw an error because of the Foreign key constraint.
What am I doing wrong?
Thanks,
/Tony.
TSQL Scripts
Posted: Tue May 18, 2004 9:47 am
by John
Texis does not support constraints, which is why no error was generated.
TSQL Scripts
Posted: Tue May 18, 2004 9:53 am
by tony.malandain
Thanks John,
Any idea of what I could do instead? Trigger? Stored Proc?
TSQL Scripts
Posted: Tue May 18, 2004 3:35 pm
by John
Generally Vortex code, which will act as stored procedure.