Options

String Formatting

caboletcabolet Posts: 8
edited February 18, 2013 9:34AM in SQL Prompt Previous Versions
It would be nice if SQL-Prompt had an option to change the output to a string that I can use in programming language.
Example:
SELECT DISTINCT
    SSD_ServerName
,	SSD_InstanceName
,	SSD_DatabaseName
,	SUM(SSD_DBFileSize_MB)
FROM
    dbo.tbl_SSD_SQLServerDatabase
WHERE
    SSD_SQS_ID			= @iInstanceID
    AND SSD_DBFileType	= 'LOG'
GROUP BY
    SSD_ServerName
,	SSD_InstanceName
,	SSD_DatabaseName

Change into:
strSQL = "SELECT DISTINCT " _
	& "     SSD_ServerName " _
	& " ,	SSD_InstanceName " _
	& " ,	SSD_DatabaseName " _
	& " ,	SUM(SSD_DBFileSize_MB) " _
	& " FROM " _
	& "     dbo.tbl_SSD_SQLServerDatabase " _
	& " WHERE " _
	& "     SSD_SQS_ID			= @iInstanceID " _
	& "     AND SSD_DBFileType	= 'LOG' " _
	& " GROUP BY " _
	& "     SSD_ServerName " _
	& " ,	SSD_InstanceName " _
	& " ,	SSD_DatabaseName "



Comments

Sign In or Register to comment.