SQL Server high-speed generate SQL additions and deletions change statements

Source: Internet
Author: User

Do you still generate SQL statements in your handwriting program? Are you still silent about the SQL statements that were sloppy? Are you still tangled in the idea of how to express complex SQL statements? Suppose your answer is "yes". Then you're out. Come on, try using SQL Server Resource Manager to generate SQL statements at high speed.
First, open SQL Server2008, and in the menu bar query drop-down menu, find "design a query in the editor", for example:



in the Query Designer form that opens, join the database table that you want to work with.



Right-click the blank part of the table that you joined. In the pop-up menu, click Change Type, and then a submenu appears: Select Insert Value, UPDATE, and delete according to the requirements to do the corresponding action.

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvdtaxmdc3mzy2nw==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/southeast "width=" "height=" >


1, insert the value.

Tick the fields you want to insert into the table, add the corresponding values below the table or add the values you want to insert directly. At this point we will notice that the bottom code box itself updates the SQL statement itself in the active synchronization. A SQL statement that inserts a value is generated like this, and of course you want to insert a record directly select all the fields OK.

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvdtaxmdc3mzy2nw==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/southeast "width=" "height=" >


2, update the data table according to the conditions. Select the fields that you want to update in the Join action table. Then you can design the corresponding field values.


watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvdtaxmdc3mzy2nw==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/southeast "width=" "height=" >

3,sql the query statement. Add the corresponding table or before we can add a view to the database first (it is suggested that the database of all related action table fields are added to the view, and then only the query statement, you can go to the view to find the corresponding field.) )。 You can then add the required table or view in the Query Designer, and then directly select the corresponding field you want to query.






4, deletion of records is also the case, no longer specific explanation.

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvdtaxmdc3mzy2nw==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/southeast "width=" "height=" >


See these. Do you still worry about a series of SQL statements that appear to be a problem?
Make full use of previous experience. Always stand on the shoulders of giants and learn. Can greatly improve our learning confidence and learning efficiency. There is a lot of knowledge and wealth waiting for us to explore slowly. Let's cheer up! ~ ~

SQL Server high-speed generate SQL additions and deletions change statements

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.