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
»
Article Discussions
»
Article Discussions by Author
»
Discuss content posted by Hardik Doshi
»
T-SQL
39 posts, Page 1 of 4
1
2
3
4
»
»»
T-SQL
Rate Topic
Display Mode
Topic Options
Author
Message
Hardy21
Hardy21
Posted Saturday, January 01, 2011 3:43 PM
SSC Eights!
Group: General Forum Members
Last Login: Yesterday @ 7:11 AM
Points: 877,
Visits: 1,159
Comments posted to this topic are about the item
T-SQL
Thanks
Post #1041579
bitbucket-25253
bitbucket-25253
Posted Saturday, January 01, 2011 4:45 PM
SSCertifiable
Group: General Forum Members
Last Login: Yesterday @ 4:00 PM
Points: 5,102,
Visits: 20,205
Nice question, got it right on a hunch .... but still learned something .. thanks
If everything seems to be going well, you have obviously overlooked something.
Ron
Please help us, help you -before posting a question please
read
Before posting a performance problem please
read
Post #1041586
Koen Verbeeck
Koen Verbeeck
Posted Sunday, January 02, 2011 5:16 AM
SSCrazy Eights
Group: General Forum Members
Last Login: Today @ 1:21 AM
Points: 9,374,
Visits: 6,471
Thanks, great question.
How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?
Member of
LinkedIn
. My blog at
LessThanDot
.
MCSA SQL Server 2012 - MCSE Business Intelligence
Post #1041618
WayneS
WayneS
Posted Sunday, January 02, 2011 8:44 PM
SSCertifiable
Group: General Forum Members
Last Login: Yesterday @ 4:35 PM
Points: 6,369,
Visits: 8,232
Excellent question, thanks!
The only thing that is missing is how to solve this type of problem - you need to split the items in the variable into their separate items, and return them as a table that can be joined or cross-applied to. Jeff Moden wrote (and several people here have contributed to) a "DelimitedSplit8K" function; a quick google search
shows many posts where it's been used/referenced
.
Wayne
Microsoft Certified Master: SQL Server 2008
If you can't explain to another person how the code that you're copying from the internet works, then
DON'T USE IT
on a production system! After all,
you
will be the one supporting it!
Links:
For better assistance in answering your questions
,
How to ask a question
,
Performance Problems
,
Common date/time routines
,
CROSS-TABS and PIVOT tables Part 1
&
Part 2
,
Using APPLY Part 1
&
Part 2
,
Splitting Delimited Strings
Post #1041690
Mayank Parmar
Mayank Parmar
Posted Monday, January 03, 2011 2:50 AM
Say Hey Kid
Group: General Forum Members
Last Login: Wednesday, September 21, 2011 4:03 AM
Points: 713,
Visits: 100
Thanks Wayne :)
I was aware of this issue since long time, but didn't had any solution.
Thanks for sharing wonderful information with us.
Regards,
--------------------------------------------------------------------------------
Mayank Parmar
Software Engineer
Clarion Technologies
SEI CMMI Level 3 Company
8th Floor, 803, GNFC info Tower,
SG Highway, Ahmedabad - 380 054,
Gujarat, India.
www.clariontechnologies.co.in
Email: mayank.parmar@clariontechnologies.co.in
MSN : mayank.parmar@clariontechnologies.co.in
Mobile: +91 9727748789
--------------------------------------------------------------------------------
Post #1041746
Nakul Vachhrajani
Nakul Vachhrajani
Posted Monday, January 03, 2011 3:13 AM
Ten Centuries
Group: General Forum Members
Last Login: Today @ 1:02 AM
Points: 1,277,
Visits: 1,609
Very good, basic question, Hardik!
This QotD reminds us to be cautious when working with the IN keyword, especially in dynamic SQL.
Have a Happy New Year ahead!
Thanks & Regards,
Nakul Vachhrajani.
http://beyondrelational.com/modules/2/blogs/77/nakuls-blog.aspx
Be courteous. Drive responsibly.
Follow me on
Twitter:
@nakulv_sql
Google Plus:
+Nakul
Post #1041751
Hugo Kornelis
Hugo Kornelis
Posted Monday, January 03, 2011 5:20 AM
SSCertifiable
Group: General Forum Members
Last Login: Today @ 2:00 AM
Points: 5,238,
Visits: 7,045
Great question!
I see so many people posting to forums or newsgroups, asking why they can't use IN (@variable) in this way with a comma-delimited list in the variable, that it's good to enforce this knowledge with a question.
And I'm glad to see that as of now, 80% of the people who answered have it right - I'm becoming a bit more optimistic about my fellow people now
Hugo Kornelis, SQL Server MVP
Visit my SQL Server blog:
http://sqlblog.com/blogs/hugo_kornelis
Post #1041771
hebahmahmoud
hebahmahmoud
Posted Monday, January 03, 2011 7:06 AM
Forum Newbie
Group: General Forum Members
Last Login: Saturday, February 26, 2011 11:22 PM
Points: 6,
Visits: 11
it is avery helpful Question ..
regards all
Eng.Heba Mahmoud
Post #1041833
SQLRNNR
SQLRNNR
Posted Monday, January 03, 2011 8:55 AM
SSCoach
Group: General Forum Members
Last Login: Monday, May 20, 2013 1:07 PM
Points: 18,733,
Visits: 12,332
Thanks for the question.
Jason
AKA CirqueDeSQLeil
I have given a name to my pain...
MCM SQL Server 2008
SQL RNNR
Posting Performance Based Questions - Gail Shaw
Posting Data Etiquette - Jeff Moden
Hidden RBAR - Jeff Moden
VLFs and the Tran Log - Kimberly Tripp
Post #1041884
Don Avery
Don Avery
Posted Monday, January 03, 2011 10:13 AM
SSC Journeyman
Group: General Forum Members
Last Login: Tuesday, May 01, 2012 7:21 PM
Points: 83,
Visits: 27
Actually, I'm right - this query will return 0 rows for both SELECT statements as it will never run - you cannot insert into a table with and Identity PK without specifying the column names on the INSERT query.
The script should have read:
INSERT INTO @student (StudentName, StudentResult)
VALUES( 'Hardy', 100), ('Rocky', 98), ('Panky', 99)
Post #1041939
« Prev Topic
|
Next Topic »
39 posts, Page 1 of 4
1
2
3
4
»
»»
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.