Monday, February 20, 2012

ISQL: Msg 170, Level 15, State 1, Line 1 Line 1: Incorrect syntax near ' '

G'day everyone
That's a space between the ticks.
It's all part of a longer script but seeing as the failure occurs on
line 1
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[config]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[config]
GO
That's three lines only. Does it matter that they're in Unicode?
Any ideas?
Kind regards,
Bruce M. Axtens
Software Engineer
Strapper TechnologiesI pasted that code into a .sql file and ran it through isql.exe and it executed without errors. What
version of SQL Server to you connect to?
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"axtens" <Bruce.Axtens@.gmail.com> wrote in message
news:1162976105.388119.97910@.b28g2000cwb.googlegroups.com...
> G'day everyone
> That's a space between the ticks.
> It's all part of a longer script but seeing as the failure occurs on
> line 1
> if exists (select * from dbo.sysobjects where id => object_id(N'[dbo].[config]') and OBJECTPROPERTY(id, N'IsUserTable') => 1)
> drop table [dbo].[config]
> GO
> That's three lines only. Does it matter that they're in Unicode?
> Any ideas?
> Kind regards,
> Bruce M. Axtens
> Software Engineer
> Strapper Technologies
>|||Tibor,
Thanks for your reply. I found out from another group that the line
count is reset each time ISQL executes a "GO" statement, so the
offending line could have been anywhere in a 123 line file.
What I ended up doing was creating two scripts from the original: one
to do the "DROP"s and the other to do the "CREATE"s.
Thanks for your time.
Kind regards,
Bruce M. Axtens
Software Engineer
Strapper Technologies

No comments:

Post a Comment