Hi

 

Background:

We have lots of SQL scripts using SQL template parameters. In SQL
Management Studio, these parameters can be replaced with values using
Ctrl+Shift+M. Sql scripts can be executed afterwards.

 

We want to keep these SQL scripts as they are(for manual execution
sometimes) and automate the above execution of these SQL scripts in msi.
Believe it has to be done via Custom Action/extension. We don't want to
reference external dll/exe and try to avoid writing Custom Action using
DTF if possible. 

 

Questions:

We would like to have something like SqlScript in SqlExtension which is
easy for developer to use.  So is it easy to implement/extend
SqlExtension so SqlScript can take formatted properties??

 

Also can you please help with the following:-

1.       Where the SQL script is read by SqlExtension

2.       Where the database call is made in SqlExtension as I tried to
read the source code of SqlExtension but could not find the entry to
interact with Database. 

3.       If have to, then how to use DFT to achieve the auto execution
of this SQL task

 

Your feedback will be very much appreciated! 

 

Best Regards

Joanna

 

Example of SQL Script:

 

SQL Script using Template Parameters:

USE <DATABASE_NAME,,value>

GO

IF EXISTS (SELECT PROD_ID, ENV_ID, DATAOWNER FROM CLIENT_CONFIG WHERE
PROD_ID = <PROD_ID,,value> AND ENV_ID = <ENV_ID,,value> AND DATAOWNER =
<DATAOWNER,,value>)

BEGIN

      UPDATE      <DATABASE_NAME,,value>.dbo.ClientTest

      SET         REALTIME_BATCH_SIZE = <REALTIME_BATCH_SIZE,,value>    

      WHERE PROD_ID = <PROD_ID,,value> 

      AND         ENV_ID = <ENV_ID,,value> 

      AND         DATAOWNER = <DATAOWNER,,value>

END

ELSE

BEGIN

INSERT INTO ClientTest

           (PROD_ID

           ,ENV_ID

           ,DATAOWNER

           ,REALTIME_BATCH_SIZE

           )

     VALUES

           (<PROD_ID,,value>

           ,<ENV_ID,,value>

           ,<DATAOWNER,,value>

           ,<REALTIME_BATCH_SIZE,,value>

            )

 

END

 

Replacing the parameters using Ctrl+Shift+M then entering the values:

USE Test

GO

IF EXISTS (SELECT PROD_ID, ENV_ID, DATAOWNER FROM CLIENT_CONFIG WHERE
PROD_ID = 1 AND ENV_ID = 1 AND DATAOWNER = 'Company')

BEGIN

      UPDATE      Test.dbo.ClientTest

      SET         REALTIME_BATCH_SIZE = 1 

      WHERE PROD_ID = 1 

      AND         ENV_ID = 1 

      AND         DATAOWNER = 'Company'

END

ELSE

BEGIN

INSERT INTO ClientTest

           (PROD_ID

           ,ENV_ID

           ,DATAOWNER

           ,REALTIME_BATCH_SIZE

           )

     VALUES

           (1

           ,1

           ,'Company'

           ,1

            )

 

END

 

Regards,
Joanna Liu

 

Analytics Development
Dealogic
3007-10, 30th Floor, The Center, 99 Queen's Road Central, Hong Kong
T: (+852) 3698-4774
F: (+852) 2529-4377
E: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> 

 

 

 

Regards,
Joanna Liu

 

Analytics Development
Dealogic
3007-10, 30th Floor, The Center, 99 Queen's Road Central, Hong Kong
T: (+852) 3698-4774
F: (+852) 2529-4377
E: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> 

 

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
WiX-devs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wix-devs

Reply via email to