SQL Server
  Home arrow SQL Server arrow Page 4 - SQL Sever: Storing Code in Binary or Text ...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
SQL SERVER

SQL Sever: Storing Code in Binary or Text Files Rather than Stored Procedures
By: Raghavendra Narayana
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 22
    2003-10-21

    Table of Contents:
  • SQL Sever: Storing Code in Binary or Text Files Rather than Stored Procedures
  • Case 1: .INI File
  • Case 2: SQL Query
  • Case 3: Complete Stored Procedure in a Binary File
  • Conclusion

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    SQL Sever: Storing Code in Binary or Text Files Rather than Stored Procedures - Case 3: Complete Stored Procedure in a Binary File


    (Page 4 of 5 )

    There are some business related functions that need to be created and/or maintained.  It is related to core business and Management does not want to explain it to the Development team.  A member of the management team has SQL Server experience and will take care of creating/editing the content of Stored Procedures.  It is then converted to a binary file and stored on the server with very specific rights.  So the task of Developer is to just read the complete binary file and execute it.

    You can even introduce encrypt/decrypt features for security purposes.  Just add converting/decrypting back to original stuff in the calling SP.

    The SP is in a Binary file.

    CREATE PROCEDURE dbo.CASE3
    AS
    BEGIN
     DECLARE @SQLsp as NVARCHAR(4000)

     --Temporary table for getting the SP
     CREATE TABLE #tmpSP (spText NVARCHAR(4000))

     --Gets the SP from .sql to Temp table
     BULK INSERT #tmpSP
        FROM '\\computer1\Thomson_Financial\SP.sql'

     --Convert/Decrypt Code on the content of SP.sql

     --Get the complete SP to a Variable to execute it
     SELECT @SQLsp = spText FROM #tmpSP

     --Execute the SP
     EXECUTE sp_executesql @SQLsp
    END

    More SQL Server Articles
    More By Raghavendra Narayana


     

    SQL SERVER ARTICLES

    - Executing SQL Server Stored Procedure from P...
    - How to Search for Date and Time Values Using...
    - Replication: SQL Server 2000 - Part 2
    - Replication: SQL Server 2000 - Part 1
    - SQL Sever: Storing Code in Binary or Text Fi...
    - Execute SQL on Multiple Tables/Columns - New...
    - How to Connect to a SQL Server from Visual F...
    - SQL Server Hardware Tuning and Performance M...
    - Primary Key on Multiple Tables – New RDBMS C...
    - Migrating from Sybase to SQL Server
    - What's Best for DBAs? GUI or T-SQL Comma...
    - How to Perform a SQL Server Performance Audit
    - An Introduction To The Bulk Copy Utility
    - SQL Server Stored Procedures 101
    - Building Your First SQL Server 2000 Database







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek