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?MadhivananFailing to plan is Planning to fail |
 |
|
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?MadhivananFailing to plan is Planning to fail
Full code here... http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=76625 |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-12-21 : 08:51:01
|
Ah... A cross post!Peter LarssonHelsingborg, Sweden |
 |
|
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 AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
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!! |
 |
|
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 AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
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 sameif( ( (@@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'GOMadhivananFailing to plan is Planning to fail |
 |
|
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 ENDGO |
 |
|
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 AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|