This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- SQL script fail
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Jan 23, 2013
02:10 PM
SQL script fail
Hello...
I am having problems with an execution of SQL Script. This is it:
USE [{%DATABASE%}]
GO
IF NOT EXISTS
(SELECT name
FROM sys.database_principals
WHERE name = '{%USERNAME%}')
BEGIN
CREATE LOGIN [{%USERNAME%}]
WITH PASSWORD = N'{%PASSWORD%}',
DEFAULT_DATABASE = [{%DATABASE%}],
CHECK_EXPIRATION = OFF,
CHECK_POLICY = OFF;
CREATE USER {%USERNAME%} FOR LOGIN {%USERNAME%};
END
I have of course, variable replacements.
When I run this in SQL Query Manager, it works, but when IS is what executed it, the attached error occurs.
![](/legacyfs/online/vb/9909_IS_ERROR.png)
Is there a way to debug this issue? for example, to know exactly what SQL command is being sent to the database engine?
Any help will be greatly appreciated
Thanks
Jaime
I am having problems with an execution of SQL Script. This is it:
USE [{%DATABASE%}]
GO
IF NOT EXISTS
(SELECT name
FROM sys.database_principals
WHERE name = '{%USERNAME%}')
BEGIN
CREATE LOGIN [{%USERNAME%}]
WITH PASSWORD = N'{%PASSWORD%}',
DEFAULT_DATABASE = [{%DATABASE%}],
CHECK_EXPIRATION = OFF,
CHECK_POLICY = OFF;
CREATE USER {%USERNAME%} FOR LOGIN {%USERNAME%};
END
I have of course, variable replacements.
When I run this in SQL Query Manager, it works, but when IS is what executed it, the attached error occurs.
![](/legacyfs/online/vb/9909_IS_ERROR.png)
Is there a way to debug this issue? for example, to know exactly what SQL command is being sent to the database engine?
Any help will be greatly appreciated
Thanks
Jaime
(1) Reply
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Jan 28, 2013
10:19 AM
Try using the SQL Server Profiler to trace the instance of SQL Server.
![](/skins/images/CC38E504FC9E1309DC48ACFEB4925670/responsive_peak/images/icon_anonymous_message.png)