Print select query output

  • i have very basic question ,i am trying to select 4 column in my select statement and want to "print" the result of the select query , dont know how i can print mutliple columns result , can some body please help?

    i know i can do that for one coulmn as below but not sure for multiple columns

    Declare @test-2 varchar(100);

    Select @test-2=count(problemid) From tasks;

    Print @test-2;

    thanks

  • you don't really print results; you'll want to toggle between grid mode and text mode to get the results you want.

    in SSMS click control + t to switch to text mode.

    run your select statement; it will appear as text in the lower panel, and you can copy and paste it with all the white space it contains.

    switch back by clicking control+d and rerun your select; it will appear in grid mode, which you can also copy and paste as a tab-delimited list directly to a text editor or excel.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply