Monday, March 19, 2012

How to edit this script to make it work right?

After run this command:
select 'sp_spaceused ' + name + 'go' from sysobjects where
type = 'U' order by name
I got results like:
sp_spaceused PSPRCSRQSTFILEgo
sp_spaceused PSPRCSRQSTMETAgo
sp_spaceused PSPRCSRQSTSTRNGgo
How to edit the script to seperate go at the line end and
make it like:
sp_spaceused PSPRCSRQSTFILE
go
sp_spaceused PSPRCSRQSTMETA
go
sp_spaceused PSPRCSRQSTSTRNG
go
Lookup REPLACE() function in SQL Server Books Online.
Anith
|||Instead you can use :
SELECT 'EXEC sp_spaceused ' + name + CHAR(13) + 'GO'
FROM sysobjects
WHERE type = 'U'
ORDER BY name ;
Anith

No comments:

Post a Comment