| Author |
Message |
gfouet
Joined: 20 Oct 2011 Posts: 2
|
Posted: Thu Oct 20, 2011 11:42 am Post subject: Script is not executed, and no error |
|
|
Hello,
I need urgent help with SQL Packager.
I packaged a script (which works perfectly when I run it manually). But when I start the .EXE, packager do its work, says everything is fine, but nothing changed in my database.
Here is the script :
| Code: |
DECLARE @DB NVARCHAR(4000);
DECLARE @SQL NVARCHAR(4000);
SET @DB = DB_NAME();
IF ( EXISTS (SELECT * FROM sys.server_principals WHERE name = N'tlmcom') )
SET @SQL = 'ALTER LOGIN ';
ELSE
SET @SQL = 'CREATE LOGIN ';
SET @SQL = @SQL + '[tlmcom] WITH PASSWORD=N''1234'', DEFAULT_DATABASE=[' + @DB + ']' +
', DEFAULT_LANGUAGE=[French], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF';
EXECUTE(@SQL);
GO
EXEC dbo.sp_changedbowner @loginame = N'tlmcom', @map = false
GO |
The command line :
| Code: |
| SQLcreateuser.exe /server:localhost,3169 /database:tlmcom_VxRx /username:SA /password:4321 /makeupgrade |
Is it a bug in Packager ? Or what am I doing wrong ?
Thanks. |
|
| Back to top |
|
 |
gfouet
Joined: 20 Oct 2011 Posts: 2
|
Posted: Thu Oct 20, 2011 1:57 pm Post subject: |
|
|
I temporally removed the IF statement, and now it works.
Looks like Packager doesn't like my IF. |
|
| Back to top |
|
 |
james.billings
Joined: 16 Jun 2010 Posts: 843 Location: My desk.
|
Posted: Fri Oct 21, 2011 12:04 pm Post subject: |
|
|
What if you remove the bracketing? i.e.
| Code: |
IF EXISTS (SELECT * FROM sys.server_principals WHERE name = N'tlmcom')
SET @SQL = 'ALTER LOGIN ';
ELSE
SET @SQL = 'CREATE LOGIN '; |
|
|
| Back to top |
|
 |
|
|
All times are GMT + 1 Hour
|
| Page 1 of 1 |
|
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
|
Powered by phpBB © 2001, 2005 phpBB Group