April 24, 2012 at 7:56 am
In SSMS
I want to get the OutPut or Result to be displayed in to Text Mode instead of Grid
when i run the query in SSMS.
For Example: When i Run the below query
create proc [dbo].[disk]
as
begin
set nocount on
DECLARE @RecoveryState nvarchar(2000)
Create table #freeDisksSpace (drive varchar(5),MBFree varchar(20))
insert into #freeDisksSpace exec sys.xp_fixeddrives
select drive as Drive ,(mbfree/1024) As [Free space in GB] from #freeDisksSpace
DROP table #freeDisksSpace
end
I will get out put in grid format..i.e table format.
DriveFree Space In GB
C182
i want to be display in Text Mode when i execute the SP.
Note : I dont want to use Short cut keys such as (ctrl+t) and any changes in SSMS.
Please let me know how to write the " Syantax " to display the result in Text Mode.
THanks .......
April 24, 2012 at 8:06 am
If by SSMS you referring to Sql Server Management Studio than follow this.
On the tool bar point to Query --> Results To --> Result to Text
Than your result will be displayed in a text mode.
April 24, 2012 at 8:10 am
or if you want the keyboard shortcut use CTRL+T
April 24, 2012 at 8:21 am
SSMS is a UI built to work with T-SQL. It is not part of T-SQL. Text mode and grid mode are functions of the UI itself, not native parts of T-SQL, so there is no syntax to switch modes within T-SQL.
Drew
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
April 24, 2012 at 8:22 am
the output of your procedure is in a dataset. it is management studio that chooses how to display this.
the only way for management studio to display it how you want is by choosing the "display as text" or CTRL-T option
unless you recode your procedure and concatenate all of your results into one long string...... but even then it will come back in a single Cell of a table rather than in text more
MVDBA
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply