String Formatting

Provides intelligent code completion for SQL Server editors.

Moderators: JonathanWatts, David Atkinson, Anu Deshpande, Paul Stephenson, Michelle Taylor, Mike Upton, justin.caldicott, Aaron Law

String Formatting

Postby cabolet » Sat Feb 16, 2013 4:25 pm

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:
Code: Select all
 
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 "



cabolet
 
Posts: 5
Joined: Wed Feb 15, 2006 7:33 am

Postby james.billings » Mon Feb 18, 2013 3:34 pm

That's quite a nice idea actually :)

Could I ask you to suggest it on our Uservoice site for Prompt? That way, we can gauge interest from other users in seeing this feature.
james.billings
 
Posts: 1144
Joined: Wed Jun 16, 2010 11:10 am
Location: My desk.


Return to SQL Prompt 5

Who is online

Users browsing this forum: No registered users and 0 guests