search
Homephp教程php手册SQL Server 2005中查询并修改数据的不合理设计

SQL Server 2005中查询并修改数据的不合理设计

Jun 13, 2016 am 10:06 AM
serversqlunreasonableReviseexistusdataInquireofdesign

在SQL Server 2000中,我们想在数据库表中直接修改数据,一般的操作方法是:在SQL Server 企业管理中,选择相应的表,点击右键,在“打开表”中选择“查询”,在SQL编辑窗口中输入SQL语句找到要修改的记录,然后在结果窗口中直接修改相应的字段。
那在SQL Server 2005中,需要怎样操作呢?
在SQL Server Management Studio中,找到相应的表,点击右键,选择“Open Table”,然后点击“Show Sql Pane”按钮,在Sql Pane窗口中输入SQL语句找到要修改的记录,然后在结果窗口中直接修改相应的字段。
也许你觉得SQL Server 2005与SQL Server 2000的操作没什么区别。
但问题就出在选择“Open Table”时,当“Open Table”,SQL Server Management Studio会执行查询表中所有记录的操作,如果表中数据很多,就会有个等待查询的时间,你会为这个等待很恼火,因为你只是想修改某个记录,这个查询根本是多余的。在SQL Server 2000中也有“Open Table”,也是查询所有记录,但SQL Server 2000还提供了“查询”操作,就是文章开始讲到的操作方法。
你也许会说SQL Server Management Studio中提供了“Script Table as”操作,但通过Script Table as的Select To查询的结果是只读的,无法进行修改。如果通过“Update to”进行操作也不方便,因为多数情况下,在修改数据之前,先要看一下原来的数据。如果直接Update,可能会由于SQL语句中输错了条件而进行了不是期望的修改。
我也是刚刚接触SQL Serve r2005,也许SQL Server 2005提供了其他方便的操作方法,但我没找到。如果你知道,欢迎你告诉我。
出处:dudu-快乐程序员


Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),