Red Gate forums :: View topic - Script is not executed, and no error
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SQL Packager 6
SQL Packager 6 forum

Script is not executed, and no error

Search in SQL Packager 6 forum
Post new topic   Reply to topic
Jump to:  
Author Message
gfouet



Joined: 20 Oct 2011
Posts: 2

PostPosted: Thu Oct 20, 2011 11:42 am    Post subject: Script is not executed, and no error Reply with quote

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
View user's profile Send private message
gfouet



Joined: 20 Oct 2011
Posts: 2

PostPosted: Thu Oct 20, 2011 1:57 pm    Post subject: Reply with quote

I temporally removed the IF statement, and now it works.
Looks like Packager doesn't like my IF.
Back to top
View user's profile Send private message
james.billings



Joined: 16 Jun 2010
Posts: 1144
Location: My desk.

PostPosted: Fri Oct 21, 2011 12:04 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic 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