output ve space while printing in sql server 2000

  • alter procedure Goals_history

    (

    @stuid nvarchar(22),

    @startyear nvarchar(22),

    @endyear nvarchar(22),

    )

    as

    begin

    select name,class,noofsubject,rank,test from @tab1

    union

    select name,class,subject,rank,test from @tab2

    where rank is not null

    and studentname=@stuid

    and accodomicyear>=@startyear

    and accodomicyear<=@endyear

    end

    OUTPUT:

    class noofsubject rank test name

    2 5 1 revision ravi

    2 5 - monthly raju

    2 5 3 midterm ravi

    6 4 - monthly somu

    2 5 - revision ravi

    expectin outputrank is null means show first)

    class noofsubject rank test name

    6 4 - monthly somu

    2 5 - monthly raju

    2 5 - revision-II ravi

    2 5 1 revision ravi

    2 5 3 midterm ravi

    :NOTE

    \ null values ve print first row of output.....

    not null is ve to print with space.... how to define

  • raghuldrag (9/10/2012)


    alter procedure Goals_history

    (

    @stuid nvarchar(22),

    @startyear nvarchar(22),

    @endyear nvarchar(22),

    )

    as

    begin

    select name,class,noofsubject,rank,test from @tab1

    union

    select name,class,subject,rank,test from @tab2

    where rank is not null

    and studentname=@stuid

    and accodomicyear>=@startyear

    and accodomicyear<=@endyear

    end

    OUTPUT:

    class noofsubject rank test name

    2 5 1 revision ravi

    2 5 - monthly raju

    2 5 3 midterm ravi

    6 4 - monthly somu

    2 5 - revision ravi

    expectin outputrank is null means show first)

    class noofsubject rank test name

    6 4 - monthly somu

    2 5 - monthly raju

    2 5 - revision-II ravi

    2 5 1 revision ravi

    2 5 3 midterm ravi

    :NOTE

    \ null values ve print first row of output.....

    not null is ve to print with space.... how to define

    Please see the first link in my signature about best practices when posting questions.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • while em using str in my query its showing error, like

    select slno,entrydate,goals,kpi,weightage,goals_review_date,reviewcomments,reviewedby,reviewdate

    from GOALSDTL

    union

    select str((slno,entrydate,goals,kpi,weightage,goals_review_date,reviewcomments,reviewedby,reviewdate),5,2)

    from GOALSDTL_History

    error:

    doest convert date into int

  • Once again, I have to remind you that this is a SQL Server 2008 forum.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • hey friend

    i am executing dis qury on sql server 2000 only...its not server 2008

  • raghuldrag (9/11/2012)


    hey friend

    i am executing dis qury on sql server 2000 only...its not server 2008

    But we still don't know what the question is. It has been suggested you read the article found at the first link in my signature. Perhaps you could read this one too. http://weblogs.sqlteam.com/jeffs/archive/2008/05/13/question-needed-not-answer.aspx

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • raghuldrag (9/11/2012)


    hey friend

    i am executing dis qury on sql server 2000 only...its not server 2008

    I guessed that much from the subject of your post.

    Here is a link to the SQL Server 2000 forum.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

Viewing 7 posts - 1 through 6 (of 6 total)

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