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 2012
»
SQL Server 2012 - T-SQL
»
T-SQL Cursors
T-SQL Cursors
Rate Topic
Display Mode
Topic Options
Author
Message
computergirl
computergirl
Posted Tuesday, October 16, 2012 9:03 PM
Forum Newbie
Group: General Forum Members
Last Login: Tuesday, October 16, 2012 9:04 PM
Points: 1,
Visits: 3
Okay I am kind of new to this and I am trying to create a table and if the user doesn't fill all the fields I need the empty field to not be shown just the fields that are filled. How can I do this using a cursor? Any pointers??
thanks in advance
Post #1373605
sriren6029
sriren6029
Posted Tuesday, October 16, 2012 10:14 PM
SSC-Enthusiastic
Group: General Forum Members
Last Login: Tuesday, May 07, 2013 1:47 AM
Points: 197,
Visits: 42
computergirl (10/16/2012)
Okay I am kind of new to this and I am trying to create a table and if the user doesn't fill all the fields I need the empty field to not be shown just the fields that are filled. How can I do this using a cursor? Any pointers??
thanks in advance
Could you elaborate on this one. Some thing like a sample so, that we could answer or give ideas on your question.
Post #1373615
dwain.c
dwain.c
Posted Thursday, November 01, 2012 6:55 PM
SSCrazy
Group: General Forum Members
Last Login: Yesterday @ 8:37 PM
Points: 2,370,
Visits: 3,252
computergirl (10/16/2012)
Okay I am kind of new to this and I am trying to create a table and if the user doesn't fill all the fields I need the empty field to not be shown just the fields that are filled. How can I do this using a cursor? Any pointers??
thanks in advance
Agreed that elaboration is needed.
First of all you refer to "fields" but SQL tables contain "columns." How many columns?
Neither can columns be "empty" - they can be NULL (which is another way to say the value is unknown).
Are you saying you want to write a query that only returns a column if that column does not contain a NULL value?
Refer to the first line in my signature. If you are new it's not too late for you. Don't think about CURSORs as a first resort. SQL processes sets, so you should think of sets first and 99.9% of the time you can solve the problem without resorting to a CURSOR (that should always be a last resort).
No loops! No CURSORs! No RBAR! Hoo-uh!
INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
Need to UNPIVOT? Why not CROSS APPLY VALUES instead?
Since random numbers are too important to be left to chance, let's generate some!
Are you too recursively challenged?
Splitting strings based on patterns can be fast!
Post #1380098
IgorMi
IgorMi
Posted Tuesday, November 13, 2012 2:13 PM
SSCommitted
Group: General Forum Members
Last Login: Yesterday @ 8:28 PM
Points: 1,906,
Visits: 1,522
computergirl (10/16/2012)
Okay I am kind of new to this and I am trying to create a table and if the user doesn't fill all the fields I need the empty field to not be shown just the fields that are filled. How can I do this using a cursor? Any pointers??
thanks in advance
Hi,
Because you're a newbie you'd better read this first: http://www.sqlservercentral.com/articles/Best+Practices/61537/
May be you think of usage ISNULL, COALESCE, or something else ... in your loop, but with such explanation we could just imagine what you need.
Regards
IgorMi
Post #1384298
aaron.reese
aaron.reese
Posted Thursday, November 15, 2012 9:27 AM
SSC Veteran
Group: General Forum Members
Last Login: Yesterday @ 6:31 AM
Points: 245,
Visits: 450
This doesn't read like an SQL issue, more a GUI issue.
I may be wrong but it sounds like what she wants is that if the field is NULL then do not display the field on the form
Changing the number of columns returned by a query would require Dynamic SQL which should be avoided whenever possible for a number of reasons
(SQL injection attacks and query plan cacheing to name two)
Post #1385242
Sean Pearce
Sean Pearce
Posted Wednesday, March 06, 2013 3:28 AM
Old Hand
Group: General Forum Members
Last Login: Yesterday @ 4:59 PM
Points: 386,
Visits: 1,425
This sounds like an issue for the presentation layer and not the data layer.
The SQL Guy @ blogspot
About Me
Post #1427266
« 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.