Microsoft KB Archive/160735

= INF: SQL Query Constant Substitution Feature =

PSS ID Number: 160735

Article Last Modified on 1/7/2000

-

The information in this article applies to:


 * Microsoft Merchant Server 1.0

-



This article was previously published under Q160735



SUMMARY
This article provides information on the query constant substitution feature of Microsoft Merchant Server version 1.0.



MORE INFORMATION
Query constant substitution facilitates staging and versioning. Constants defined in the registry can be used in SQL queries. For example, you can define a table name as either a store-specific constant or as a Merchant Server level constant in the registry. This constant can then be used in the SQL queries stored in your store_sql table. To create your own constant, use Merchant Server's constants key in the registry, either at the store level, or at the server level.

The following example demonstrates how to use this feature:   Run the following SQL statements in the database that contains Clockped's tables in ISQL/w (if you are using Microsoft SQL Server) or in your RDBMS query tool: create table test(col1 int) insert test values(10)   Add a new key named 'Test' and a string named 'mytable' with a value of 'test' to the following registry key:      HKEY_LOCAL_MACHINE\Software\Microsoft\MerchantServer\Stores\ Clockped\Constants   Run the following SQL query in the database that contains Clockped's tables in ISQL/w (if you are using Microsoft SQL Server) or in your RDBMS query tool: insert clockped_sql values('querysubst','select * from #mytable') Note that "##" will be converted into "#" in query strings. Also, if your query string contains #xxx (where xxx is equal to one of the constants), the #xxx value will be replaced with that constant's value. In the SQL query above, '#mytable' will be replaced by 'test.'   Add the following code to welcome.html in the Clockped\Login \Templates directory: Testing the constant 'mytable' in a query: [fetchrows results "querysubst"] There are [value results.count] row(s) in "[value const.mytable]" table and the first row is:[eachcolvalue results] [value results.colvalue] [/eachcolvalue]

Testing the constant 'mytable' in tfetchcrows: [tfetchrows results2 const.mytable] There are [value results2.count] row(s) in "[value const.mytable]" table and the first row is:[eachcolvalue results2] [value results2.colvalue] [/eachcolvalue]   Run the following URL in your browser to check the results: http:///prd.i/pgen/clockped /0L/welcome.html </ol>

Keywords: KB160735

Technology: kbAudDeveloper kbMerchServ100 kbMerchServSearch

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© 2004 Microsoft Corporation. All rights reserved.