November 22, 2012 at 4:04 am
how to store perfmon data(.csv) into sql table.create a schedule job
November 22, 2012 at 4:14 am
This was removed by the editor as SPAM
November 22, 2012 at 4:55 am
Hi,
I need SP which scripts all the databases and store it into a CSV file with the name DBNAME_DATE.csv This CSV file should contain all the scripts of tables,views,triggers,etc..
Please treat this with high priority. We used the below script in sql 2000.
CREATE Procedure dbObjectBackup
as
DECLARE @name VARCHAR(50) -- database name
DECLARE @path VARCHAR(256), @path1 varchar(256) -- path for backup files
DECLARE @fileName VARCHAR(256) -- filename for backup
DECLARE @fileDate VARCHAR(20) -- used for file name
DECLARE @sql VARCHAR(250)
Declare @ServerName Varchar(25)
Declare @exeFile varchar(200)
set @ServerName = 'SQLINST1'
set @exeFile = 'D:\Progra~1\Micros~1\MSSQL\Upgrade\scptxfr.exe'
SET @path = 'D:\ScriptBackup\'
SET @path1 = '\\IP\All_Backup_21102008\IP1\'
SELECT @fileDate = CONVERT(VARCHAR(20),GETDATE(),112)
DECLARE db_cursor CURSOR FOR
SELECT name
FROM master.dbo.sysdatabases
WHERE name NOT IN ('msdb','tempdb','Pubs', 'Northwind')
OPEN db_cursor
FETCH NEXT FROM db_cursor INTO @name
WHILE @@FETCH_STATUS = 0
BEGIN
set @sql = 'exec master..xp_cmdshell ''' + @exeFile + ' /s ' + @ServerName + ' /I /d ' + @Name + ' /f ' + @path + @Name + '_' + @fileDate + '.sql'''
exec (@sql)
set @sql = 'exec master..xp_cmdshell ''' + @exeFile + ' /s ' + @ServerName + ' /I /d ' + @Name + ' /f ' + @path1 + @Name + '_' + @fileDate + '.sql'''
-- exec (@sql)
FETCH NEXT FROM db_cursor INTO @name
END
CLOSE db_cursor
DEALLOCATE db_cursor
Thanks in advance.
November 22, 2012 at 5:10 am
This was removed by the editor as SPAM
November 22, 2012 at 5:15 am
sorry :blink:
I am confused because of this task. There is lot of torture for me in this task. So please help me.
November 22, 2012 at 5:22 am
This was removed by the editor as SPAM
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply