Simple query cases in SQL Server

/** Name: Human Resource Management System database*//* Switch to System database master;*/Use master;GO/* If an HR table exists in the current system, delete it;IF EXISTS (SELECT 1 from sysdatabases WHERE name = ' HR ')BEGINDROP DATABASE

SQL Server 2000 replication synchronization Configuration and FAQs

SQL Server 2000 replication synchronization Configuration and FAQs (top)Recently, due to the use of SQL Server2000 synchronous replication, the configuration of a distribution, publisher and Subscriber synchronization between the database, which

SQL Server: Reading notes from the book of "The Must-know-all" (iv)

4th lessonFiltering Data4.1 Using the WHERE clause: filteringRetrieving only the data you need requires you to specify the search criteria (that is, the filtering criteria).The WHERE clause is given after the table name (FROM clause) and is filtered

SQL Server takes the latest record in a recent group

/*1 Use a subquery to filter out ParentID NULL*/Select * fromBid_projectpackagealtereddesigninfo t0where exists( Select 1 from ( SelectParentID,Max(Altertime) asAltertime fromBid_projectpackagealtereddesigninfoGroup byparentid)

SQL Server Log Shipping

You can use log shipping to send transaction logs uninterrupted from one database (primary database) to another (secondary database). Continuously back up the transaction logs in the primary database, and then copy and restore them to the secondary

Simple SQL Server online viewing and execution system

In large companies, often the database and the table are very much, a table of the field will also have dozens of. If so many of the tables and fields are not annotated, it will be confused to see that the new or other department colleagues see that

SQL Server: Reading notes from the book of "The Must-know-all" (iii)

3rd class sorting Retrieve data3.1 Sorting dataThe following SQL statement returns a single column for a database table. Observe its output, and there is no specific order.SELECT Prod_name from Products;Hint relational database design theory argues

Create a unique partition index on a SQL Server->> partition table

Today, while reading Oracle Advanced SQL Programming, there is a section in the chapter on global indexing of Oracle. If you create a unique index on a partitioned table, and the index itself is partitioned, you must also add the partition column to

SQL Server self-increment and delete truncate DELETE statement relationships

Define a self-increment column, use Delete, and then insert the data, the self-increment column is still incremented by the maximum value before deletion; If you use truncate and then insert the data, the self-increment column increments from the

SQL Server views the cache and reasonably sets the maximum memory

SQL Server servers run for a while to discover that memory has soared to 98% (the first time this problem was thought to be a virus, Trojan, system to crash ...) Later, I have been groping for some time to share our experience.Workaround:

SQL Server Vertical Sub-table

When the single-table data is too long, we can divide horizontally, refer to SQL Server partitioned view to achieve horizontal table, horizontal division can improve some performance of the table.Vertical tables are relatively rarely seen and used,

SQL Server finds the position of the nth occurrence of a character in a string

前几天的考试系统出现了一个问题,背景大概就是告诉你正确答案,比如说是:答案1#答案2#答案3...而几百个学生答题的记录也是这样格式存储的,问如何用sql语句为每个学生判分?思路:第一步:找到第N个#在字符串中的位置create function fn_find(@find varchar(8000), @str varchar(8000), @n smallint)    returns intasbegin    if @n

SQL Server stored procedures for paged queries

CREATE PROCEDURE Prcpageresult--Get data from a page--@currPage INT = 1,--The current page number (that is, top currpage)@showColumn VARCHAR (2000) = ' * ',--the field to be obtained (i.e. Column1,column2,......)@tabName VARCHAR (2000),--The name of

SQL Server removes the primary key constraint that is thought of

The following code has been found on the Internet:DECLARE @Pk varchar (100);Select @Pk =name from sysobjects where parent_obj=object_id (' table name ') and xtype= ' Pk ';If @Pk is not nullBeginEXEC (' Alter table name Drop ' + @Pk)--Delete the

SQL Server obtains the primary key for the specified table

Sometimes to get the table primary key field, although the system from the stored procedure can be obtained, but for familiar with the system table, it is easy to write yourself.2 Declare @table_name varchar 3 Set @table_name = ' TABLE_PQS '

View memory usage for SQL Server

The previous article mentions that dynamic T-SQL produces more execution plans, and how much memory is consumed by these execution plans? I found the answer in Xu Haiwei's book today. Dynamic view not only can find the cache of execution plan, the

ASP. NET connection to SQL Server database

Before connecting the SQL Server database in ASP. NET, first make sure that sqlserver2008 is installed properly and that there is a database.Add a class db to your project that is specifically responsible for performing additions and deletions to

SQL Alawayson: SQL Server joins the domain

Disclaimer: Because the first article, configure the domain server, with the other people's diagram, so that IP is not mine.So far, my domain controller IP is 192.168.8.230 Domain Name: dataserver.comThe agreed SQL1 IP is 192.168.8.231 User name:

IO performance check for SQL Server

The one-month-old was entangled in an information section chief because their SQL Server, R2, was always performing poorly on regular writes. I think so, but people around me don't seem to think so. When I express my concern about the networked

SQL Server Partitioned view implementation sub-table

We all know that when the amount of database data is large, data can be horizontally extended, such as sub-Library, partition, sub-table (also called partition) and so on. One scenario for a sub-table is to use the partitioned view

Total Pages: 923 1 .... 423 424 425 426 427 .... 923 Go to: GO

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.