DotNetNuke 'Run As Script' sql option

What does the Run as Script option do on the Host-> Sql page in DotNetNuke?

+4
source share
3 answers

If the Run as Script check box is not selected, you can provide only one SQL statement. The results of this query will be displayed in the grid.

If the Run as Script checkbox is selected, you can provide multiple SQL statements, separated by the GO keyword. In this mode, the results will not be displayed, just a message that successfully completed the request (or error messages if it was not). This is the same mode that is used when installing the extension.

Note that the statements are completely separated by the GO keyword, so you cannot have constructs (such as a transaction) that complete the GO statement, since the start and end of the construct will be completely separated.

+3
source

means you are using a script with more than one sql statement

0
source

The Run as Script option allows you to insert SQL statements that have special identifiers that are automatically replaced by your SQL data provider. These identifiers are defined in the web.config file under dotnetnuke > data > providers . By default, this section will look like this:

 <data defaultProvider="SqlDataProvider"> <providers> <clear/> <add name="SqlDataProvider" type="DotNetNuke.Data.SqlDataProvider, DotNetNuke.SqlDataProvider" connectionStringName="SiteSqlServer" upgradeConnectionString="" providerPath="~\Providers\DataProviders\SqlDataProvider\" objectQualifier="" databaseOwner="dbo"/> </providers> </data> 

Pay attention to the attributes objectQualifier and databaseOwner ? If you insert an SQL statement into the Host> SQL field containing {objectQualifer} and / or {databaseOwner}, these values ​​will automatically be replaced with the values ​​for the above attributes.

So, let's say you paste the following SQL statement into this field with the "Run as Script" checkbox:

 CREATE TABLE {databaseOwner}[{objectQualifier}Cars] 

Assuming we use the values ​​in the above web.config snippet, the SQL statement that will be executed will look like this:

 CREATE TABLE [dbo][Cars] 
-one
source

All Articles