Forum Etiquette: How to post data/code on a forum to get the best help

  • 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.

  • 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. :blush:

  • 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.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • 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

  • Please post your problem in a new thread. Thanks

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    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
  • 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.

  • 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,

    ...

  • 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 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,

    ...

    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.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • 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 Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • 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.:-)

  • OK i now see that SQLFiddle is for MySQL, not SQL Server;

    i guess it is some kind of front end tester, where you can build a temporary schema in the left panel, and test queries on the right.

    not useful to me, but maybe to others.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Lowell (3/27/2013)


    OK i now see that SQLFiddle is for MySQL, not SQL Server;

    i guess it is some kind of front end tester, where you can build a temporary schema in the left panel, and test queries on the right.

    not useful to me, but maybe to others.

    Lowell I did find a language dropdown in the upper left. Once doing that it parsed sql correctly. But I still don't understand what the point is.

    _______________________________________________________________

    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 Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • Sean Lange (3/27/2013)


    Lowell (3/27/2013)


    OK i now see that SQLFiddle is for MySQL, not SQL Server;

    i guess it is some kind of front end tester, where you can build a temporary schema in the left panel, and test queries on the right.

    not useful to me, but maybe to others.

    Lowell I did find a language dropdown in the upper left. Once doing that it parsed sql correctly. But I still don't understand what the point is.

    I recently started answering some questions on stackoverflow and from what I've seen there it's fairly handy. It allows someone to set up a structure, with data, and some test code. That way you can ask your question and direct people over to sqlfiddle to see the code/example.

    Kenneth FisherI was once offered a wizards hat but it got in the way of my dunce cap.--------------------------------------------------------------------------------For better, quicker answers on T-SQL questions, click on the following... http://www.sqlservercentral.com/articles/Best+Practices/61537/[/url]For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/[/url]Link to my Blog Post --> www.SQLStudies.com[/url]

  • Kenneth.Fisher (3/27/2013)


    Sean Lange (3/27/2013)


    Lowell (3/27/2013)


    OK i now see that SQLFiddle is for MySQL, not SQL Server;

    i guess it is some kind of front end tester, where you can build a temporary schema in the left panel, and test queries on the right.

    not useful to me, but maybe to others.

    Lowell I did find a language dropdown in the upper left. Once doing that it parsed sql correctly. But I still don't understand what the point is.

    I recently started answering some questions on stackoverflow and from what I've seen there it's fairly handy. It allows someone to set up a structure, with data, and some test code. That way you can ask your question and direct people over to sqlfiddle to see the code/example.

    Like I said it seems like it might be pretty cool but it is for some reason not intuitive to me how to use it and I don't see a tutorial or anything anywhere. These kinds of utilities are often pretty awesome once you understand how to use it but trying to figure it out on your own is sometime more effort than it is worth.

    _______________________________________________________________

    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 Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • I guess my take on such a thing as SQLFiddle is if we can't even get someone to cut and paste a CREATE TABLE statement, what makes us think they'll use the likes of SQLFiddle? Yeap... WE could use it to help us create an answer but, frequently, a question is so poorly worded that without a CREATE TABLE statement from the OP, it's sometimes impossible to figure out what the question actually is.

    --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.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 15 posts - 151 through 165 (of 211 total)

You must be logged in to reply to this topic. Login to reply