Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 2008
»
T-SQL (SS2K8)
»
output ve space while printing in sql server...
output ve space while printing in sql server 2000
Rate Topic
Display Mode
Topic Options
Author
Message
raghuldrag
raghuldrag
Posted Monday, September 10, 2012 5:37 AM
SSC-Enthusiastic
Group: General Forum Members
Last Login: Monday, June 17, 2013 2:36 AM
Points: 105,
Visits: 259
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
Sean Lange
Sean Lange
Posted Monday, September 10, 2012 8:50 AM
SSCrazy Eights
Group: General Forum Members
Last Login: Yesterday @ 3:32 PM
Points: 8,980,
Visits: 8,540
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
Post #1356796
raghuldrag
raghuldrag
Posted Monday, September 10, 2012 10:41 PM
SSC-Enthusiastic
Group: General Forum Members
Last Login: Monday, June 17, 2013 2:36 AM
Points: 105,
Visits: 259
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
Phil Parkin
Phil Parkin
Posted Tuesday, September 11, 2012 1:37 AM
SSCarpal Tunnel
Group: General Forum Members
Last Login: Today @ 12:19 AM
Points: 4,328,
Visits: 9,666
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:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
If you are asking for help and your post does not contain a question, you should expect responses which do not contain any answers. Put a question mark in there somewhere - it's not rocket science.
Post #1357175
raghuldrag
raghuldrag
Posted Tuesday, September 11, 2012 7:07 AM
SSC-Enthusiastic
Group: General Forum Members
Last Login: Monday, June 17, 2013 2:36 AM
Points: 105,
Visits: 259
hey friend
i am executing dis qury on sql server 2000 only...its not server 2008
Post #1357380
Sean Lange
Sean Lange
Posted Tuesday, September 11, 2012 7:21 AM
SSCrazy Eights
Group: General Forum Members
Last Login: Yesterday @ 3:32 PM
Points: 8,980,
Visits: 8,540
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
Post #1357387
Phil Parkin
Phil Parkin
Posted Tuesday, September 11, 2012 7:45 AM
SSCarpal Tunnel
Group: General Forum Members
Last Login: Today @ 12:19 AM
Points: 4,328,
Visits: 9,666
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:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
If you are asking for help and your post does not contain a question, you should expect responses which do not contain any answers. Put a question mark in there somewhere - it's not rocket science.
Post #1357411
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.