Reply to topic
Incorrect syntax near the keyword 'ON'.
kramm


Joined: 30 Mar 2008
Posts: 4
Reply with quote
I have a CF8 site and my database is MS SQL

I am running a query that is creating database tables.

I receive this error:
Error Executing Database Query. [Macromedia][SQLServer JDBC Driver][SQLServer]Incorrect syntax near the keyword 'ON'.

My code has sever scripts similar to this

Code:

ALTER TABLE TBLpage ADD
   CONSTRAINT FK_TBLpage_entry FOREIGN KEY
   (
      id
   ) REFERENCES TBLentry (
      id
   ) ON DELETE CASCADE  ON UPDATE CASCADE




why does MS SQL not like ON DELETE CASCADE ON UPDATE CASCADE??


thanks.
dmalone
HostMySite Tech

Joined: 23 Nov 2004
Posts: 65
Reply with quote
I'm not a SQL expert so I am not sure how the syntax should look, but I would try running the query in SQL Management Studio directly to see if you get a better error.

-Dave
Re: Incorrect syntax near the keyword 'ON'.
Jason101
Forum Regular

Joined: 14 Mar 2006
Posts: 570
Location: Harrisburg, PA
Reply with quote
Try this. It's not much different, but give it a shot and run it in Management Studio:

Code:

ALTER TABLE TBLpage
ADD CONSTRAINT FK_TBLpage_entry FOREIGN KEY (id)
  REFERENCES TBLentry (id)
  ON UPDATE CASCADE
  ON DELETE CASCADE
GO
SGL Query issue
kramm


Joined: 30 Mar 2008
Posts: 4
Reply with quote
At work, I had our DB administrator run the Script to generate the database tables on a MS SQL 2000 server as well as MS SQL 2005 server. It ran successfully on both.

Seems as though there is some setting issue?? at HostMySite.com??

Any thoughts??

Thanks for the help.
Kelly
dmalone
HostMySite Tech

Joined: 23 Nov 2004
Posts: 65
Reply with quote
Well I would guess that your DBA ran it as a server administrator on your local database, so since you don't have server admin access in the shared environment that may be an issue. That being said, you should have DBO access to your database which should give you the ability to do whatever you need.

If you run the query in management studio directly and the error isn't any better, give us a ring and open a support ticket about it and we will be able to look at the settings on the database in depth.


-Dave
SQL7
kramm


Joined: 30 Mar 2008
Posts: 4
Reply with quote
I put in a support ticket and turns out my database was on a SQL7 server.
No wonder I am having issues.... geez not what I signed up for.

Hopefully the database will be upgraded to SQL2005 without issue or charge.
Re: SQL7
Jason101
Forum Regular

Joined: 14 Mar 2006
Posts: 570
Location: Harrisburg, PA
Reply with quote
kramm wrote:
I put in a support ticket and turns out my database was on a SQL7 server.
No wonder I am having issues.... geez not what I signed up for.

Hopefully the database will be upgraded to SQL2005 without issue or charge.


Oh geez.. Didn't even know SQL7 was an option anymore. YIKES! Shocked
dmalone
HostMySite Tech

Joined: 23 Nov 2004
Posts: 65
Reply with quote
Wow that is really pretty odd, because that hasn't been an option for over 4 years. Can you PM me the ticket number so I can take a look at exactly what happened on our end?

Sorry for the trouble with this!

-Dave
Incorrect syntax near the keyword 'ON'.
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT  
Page 1 of 1  

  
  
 Reply to topic