in

SQL Server Blogs

Voices from the UK SQL Server Community

Browse by Tags

  • SQL Nugget - script content of a table as INSERT statements

    I have wrestled a couple of times what was easy when I used TOAD but became painful with SQL Server. For example you have a control table that is manually edited most of the times in DEV. When you want to move it to TEST you can transfer the whole table but in terms of source control it's better...
    Posted to MartinIsti MS BI blog (Weblog) by MartinIsti on Wed, Oct 20 2010
  • Script out Procedures to seperate files

    In this post script-out-procedures-and-functions-part-2 , I showed how to script out the procedures in a single file Here is another way to do the same but different file for each procedure. The file name will be the name of the procedure. declare @sps table ( proc_name varchar ( 100 ), texts varchar...
    Posted to Madhivanan (Weblog) by Madhivanan on Mon, Oct 26 2009
  • How to Generate Script along with Data?

    One of the new features available in SQL Server 2008 is scripting the tables along with data (in the form of INSERT statements). Here are the useful links that can help you generating script with data SQL Server 2008 http://www.kodyaz.com/articles/sql-server-script-data-with-generate-script-wizard.aspx...
    Posted to Madhivanan (Weblog) by Madhivanan on Fri, Aug 21 2009
  • Script out Procedures and Functions - Part 2

    Part 1 uses information_Schema.routines view and this is based on sp_helptext declare @sps table ( texts varchar ( 8000 )) insert into @sps select 'sp_helptext ''' + name + '''' from sysobjects where xtype in ( 'p' , 'fn' ) order by xtype , name create table scripts ( sps varchar ( 8000 )) declare @texts...
    Posted to Madhivanan (Weblog) by Madhivanan on Thu, Dec 13 2007
  • Generate SQL Script

    --This procedure will generate the structure of the table Create Procedure GenerateScript ( @tableName varchar(100)) as If exists (Select * from Information_Schema.COLUMNS where Table_Name= @tableName) Begin declare @sql varchar(8000) declare @table varchar(100) declare @cols table (datatype varchar...
    Posted to Madhivanan (Weblog) by Madhivanan on Mon, Aug 27 2007
  • Scripts Stored Procedures and Functions through query

    This query will script the Procedures and Functions All you have to do is replace DBname by the actual Database Name exec master..xp_cmdshell 'bcp "Select routine_definition from DBname.information_Schema.routines order by routine_name" queryout "C:\scripts.sql" -c' After it runs successfully, the file...
    Posted to Madhivanan (Weblog) by Madhivanan on Mon, Aug 27 2007
Page 1 of 1 (6 items)
Powered by Community Server (Commercial Edition), by Telligent Systems