|
|
|
Valued Member
      
Group: General Forum Members
Last Login: Thursday, April 18, 2013 2:24 PM
Points: 59,
Visits: 161
|
|
Lynn, Thanks for that post. It made me realize how I can improve some of my own queries.
The light came on.
This is a fantastic thread.
|
|
|
|
|
Mr or Mrs. 500
      
Group: General Forum Members
Last Login: Friday, March 22, 2013 5:58 PM
Points: 561,
Visits: 440
|
|
Never mind advice on forum posting, excellent though it is. I bookmarked this article as "Export table contents into flat file."
Next thing I'll do is write a query to generate the QUOTENAME query for a given table. 
P.S.: Oh wait, I have bookmarked it before.
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Yesterday @ 8:21 PM
Points: 32,893,
Visits: 26,765
|
|
They say a compliment is a good thing. Two by the same person on the same subject is a sure thing. Thanks, Olga.
--Jeff Moden "RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".
First step towards the paradigm shift of writing Set Based code: Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."
For better, quicker answers on T-SQL questions, click on the following... http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Monday, December 24, 2012 3:48 AM
Points: 3,
Visits: 1
|
|
i have a table under below- tblEmp(eid int primary key identity(1001,1), ename varchar(100),Eaddress varchar(100), estate varchar(100), loc varchar(100), doj date, dob date, edesc varchar(200)) now when i insert this
insert into tblEmp values('Rakesh Kaushik','Nalagarh','abc','2001-01-11','12001-01-11',1,1,1)
i got error Operand type clash: int is incompatible with date pls help me
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Yesterday @ 12:59 PM
Points: 37,640,
Visits: 29,895
|
|
Please post your problem in a new thread. Thanks
Gail Shaw Microsoft Certified Master: SQL Server 2008, MVP SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter We stand on the bridge and no one may pass
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Tuesday, May 14, 2013 8:56 PM
Points: 160,
Visits: 420
|
|
Are you kidding me? someone posts into a discussion on forum etiquette asking a new question and breaking most of the rules of forum etiquette in the process!
Anyway.... I'm suprised sqlfiddle isn't used more to assist in setting up a test bed - it's all over Stackoverflow.com. I guess people like to have the source in the question, not in another site.
http://sqlfiddle.com/
My forum posting has got to the point where I will post a very general answer just to work out whether the original poster is even giong to get back to the question, before I fully engage in answering.
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Wednesday, May 01, 2013 9:42 AM
Points: 2,
Visits: 62
|
|
Nice article. Only comment I would add is that I find your indentation makes the code difficult to read for me.
So with this:
FROM #MyTable v, (--==== Derived table "fs" finds ID of the first row -- where stanation of VALUE occurs SELECT MIN(ID) AS FirstIDOfStagnation FROM #MyTable v, ... I find the following easier to read
SELECT v.* FROM #MyTable v, (--==== Derived table "fs" finds ID of the first row -- where stanation of VALUE occurs SELECT MIN(ID) AS FirstIDOfStagnation FROM #MyTable v, ...
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Yesterday @ 8:21 PM
Points: 32,893,
Visits: 26,765
|
|
Guy Thiebaut (3/27/2013)
Nice article. Only comment I would add is that I find your indentation makes the code difficult to read for me. So with this: FROM #MyTable v, (--==== Derived table "fs" finds ID of the first row -- where stanation of VALUE occurs SELECT MIN(ID) AS FirstIDOfStagnation FROM #MyTable v, ... I find the following easier to readSELECT v.* FROM #MyTable v, (--==== Derived table "fs" finds ID of the first row -- where stanation of VALUE occurs SELECT MIN(ID) AS FirstIDOfStagnation FROM #MyTable v, ...
To each their own. I have a similar problem with code that's left justified with no separation between key words and the objects of those words. Other than my particular taste for readability, the reason I use such a vertically aligned format is so that I can easily select vertical segments of code using the "Alt" key.
As I've said many times, the quickest way to start a fight with someone is to tell them how to format their code for readabilty. The only reason why I even brought it up in the article is because the formatting of some questions is so poor that you spend more time trying to reformat it to be able to read it than you do actually solving the problem. Some reasonable form of indentation is always better than, say, 585 characters on one line like I've run into many times in the past.
--Jeff Moden "RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".
First step towards the paradigm shift of writing Set Based code: Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."
For better, quicker answers on T-SQL questions, click on the following... http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
|
|
|
|
|
SSCrazy Eights
        
Group: General Forum Members
Last Login: 2 days ago @ 8:46 AM
Points: 8,547,
Visits: 8,204
|
|
nick.mcdermaid (3/27/2013) Are you kidding me? someone posts into a discussion on forum etiquette asking a new question and breaking most of the rules of forum etiquette in the process!
Anyway.... I'm suprised sqlfiddle isn't used more to assist in setting up a test bed - it's all over Stackoverflow.com. I guess people like to have the source in the question, not in another site.
http://sqlfiddle.com/
My forum posting has got to the point where I will post a very general answer just to work out whether the original poster is even giong to get back to the question, before I fully engage in answering.
I have never heard of sqlfiddle until now. Does it come with a users manual? I tried creating a table and then running some sql. All it does is no work for me. I assume I am not using the tool the way the author intended but if I can't figure it out I assume there is something missing in the intuitive portion. It looks clean but I can't figure out how to use it or what it is for.
_______________________________________________________________
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
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Wednesday, May 01, 2013 9:42 AM
Points: 2,
Visits: 62
|
|
Absolutely, and thanks for not reacting to my style issues. You are right - it's a case of degree and a one line joined query is way harder to read than an indented piece of code.
|
|
|
|