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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Annoying "Incorrect syntax error near ")"...

Author  Topic 

Jaybee from his castle
Yak Posting Veteran

64 Posts

Posted - 2006-12-21 : 08:18:03
An old chestnut I know...any ideas??


if not exists (select * from master.dbo.syslogins where loginname = N'usraspstate')
BEGIN
declare @logindb nvarchar(132), @loginlang nvarchar(132)

select @logindb = N'aspstate', @loginlang = N'us_english'

if @logindb is null or not exists (select * from master.dbo.sysdatabases where name = @logindb)





Jaybee.

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-12-21 : 08:20:48
Did you post the full code you used?

Madhivanan

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

Jaybee from his castle
Yak Posting Veteran

64 Posts

Posted - 2006-12-21 : 08:41:31
quote:
Originally posted by madhivanan

Did you post the full code you used?

Madhivanan

Failing to plan is Planning to fail



Full code here... http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=76625
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-12-21 : 08:51:01
Ah... A cross post!


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-12-21 : 08:52:30
Are you sure error is on the code you just posted here...because it seems to be okay!

I see in some places, even after last column definition you are putting comma. Even though it won't cause error, try to avoid such things. Also isolate error to particular piece of code and post that specific code here for faster response.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

Jaybee from his castle
Yak Posting Veteran

64 Posts

Posted - 2006-12-21 : 09:11:17
Yeah, if I highlight the above within the entire script pasted in QA, then run it, it comes back with that ")" message....

something must be wrong!!

Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-12-21 : 09:15:28
Of course, it will give error if you just highlight and execute the code posted, because there is no corresponding END to BEGIN. Also there is no body for inner IF.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-12-21 : 09:19:32
On the other topic, note that number of opening and closing braces are not same

if( ( (@@microsoftversion / power(2, 24) = 8) and (@@microsoftversion & 0xffff >= 724) ) or ( (@@microsoftversion / power(2, 24) = 7) and (@@microsoftversion & 0xffff >= 1082) ) )
exec sp_dboption N'aspstate', N'db chaining', N'false'
GO


Madhivanan

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

Jaybee from his castle
Yak Posting Veteran

64 Posts

Posted - 2006-12-21 : 10:13:35
Here's the script with the 'Begin' statement closed off...

if not exists (select * from master.dbo.syslogins where loginname = N'usraspstate')
BEGIN
declare @logindb nvarchar(132), @loginlang nvarchar(132)

select @logindb = N'aspstate', @loginlang = N'us_english'

if @logindb is null or not exists (select * from master.dbo.sysdatabases where name = @logindb)

/************************************/
/*Default to the aspstate database. */
/************************************/

select @logindb = N'aspstate'

if @loginlang is null or (not exists (select * from master.dbo.syslanguages where name = @loginlang)
and @loginlang <> N'us_english')

select @loginlang = @@language

exec sp_addlogin N'usraspstate', 'usraspstate', @logindb, @loginlang
END
GO
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-12-21 : 10:19:18
There seems to be no error in that piece of code..(of course, I commented out sp_addlogin but that looks fine).

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page
   

- Advertisement -