SQL Query

  • Hello people,

    I am total new to SQL server query programming.

    I need to gather information by writing a own query to our SQL server,

    I using LinQpad 4,

    But I have less experience but I know programming pretty well.

    now my question...

    is there any DANGEROUS query commands I will avoid from.

    I believe "Delete" is one..

    (it's very important that I don't modify/change/delete any data on any circumstances)

    Please help a newbie out

    Thank you in advance

  • elmnas (9/15/2015)


    Hello people,

    I am total new to SQL server query programming.

    I need to gather information by writing a own query to our SQL server,

    I using LinQpad 4,

    But I have less experience but I know programming pretty well.

    now my question...

    is there any DANGEROUS query commands I will avoid from.

    I believe "Delete" is one..

    (it's very important that I don't modify/change/delete any data on any circumstances)

    Please help a newbie out

    Thank you in advance

    If you only want to view information then only run select statements. You might want to consider doing some reading before you dive into writing queries. The stairways articles on this site (over there on the left) has an excellent series to help get started writing queries. http://www.sqlservercentral.com/stairway/75773/[/url]

    _______________________________________________________________

    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/

  • elmnas (9/15/2015)


    (it's very important that I don't modify/change/delete any data on any circumstances)

    Then don't use a production database. Making changes to a test database would have less dire consequences.

    Moreover, if you don't want to modify the database, don't use a login that has permissions to do so.

    -- Gianluca Sartori

  • Always do this before any update/insert/delete.

    begin tran

    -- your insert/update/delete code here

    -- select code to test your changes

    rollback

    -- commit

    This will run the commands, then undo them. Be careful if your commands affect a lot of rows, and really start with SELECTs, as mentioned above. If you are confident in your code, then you can comment the rollback out and uncomment the commit.

Viewing 4 posts - 1 through 3 (of 3 total)

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