Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

output ve space while printing in sql server 2000 Expand / Collapse
Author
Message
Posted Monday, September 10, 2012 5:37 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Monday, July 21, 2014 11:33 PM
Points: 172, Visits: 427
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
Post #1356668
Posted Monday, September 10, 2012 8:50 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 2:32 PM
Points: 13,302, Visits: 12,168
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 Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Post #1356796
Posted Monday, September 10, 2012 10:41 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Monday, July 21, 2014 11:33 PM
Points: 172, Visits: 427
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
Post #1357132
Posted Tuesday, September 11, 2012 1:37 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: 2 days ago @ 2:06 PM
Points: 5,047, Visits: 11,797
Once again, I have to remind you that this is a SQL Server 2008 forum.


Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

When you ask a question (and please do ask a question: "My T-SQL does not work" just doesn't cut it), please provide enough information for us to understand its context.
Post #1357175
Posted Tuesday, September 11, 2012 7:07 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Monday, July 21, 2014 11:33 PM
Points: 172, Visits: 427
hey friend
i am executing dis qury on sql server 2000 only...its not server 2008
Post #1357380
Posted Tuesday, September 11, 2012 7:21 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 2:32 PM
Points: 13,302, Visits: 12,168
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 Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Post #1357387
Posted Tuesday, September 11, 2012 7:45 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: 2 days ago @ 2:06 PM
Points: 5,047, Visits: 11,797
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.



Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

When you ask a question (and please do ask a question: "My T-SQL does not work" just doesn't cut it), please provide enough information for us to understand its context.
Post #1357411
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse