SQL¸½¼ÓÊý¾Ý¿âºó,Êý¾Ý¿âÊÇÖ»¶ÁµÄ
·½·¨Ò»
1.н¨Ò»¸öͬÃûµÄÊý¾Ý¿â
2.ÔÙÍ£µôsql server(×¢Òâ²»Òª·ÖÀëÊý¾Ý¿â)
3.ÓÃÔÊý¾Ý¿âµÄÊý¾ÝÎļþ¸²¸ÇµôÕâ¸öн¨µÄÊý¾Ý¿â
4.ÔÙÖØÆôsql server
5.´Ëʱ´ò¿ªÆóÒµ¹ÜÀíÆ÷ʱ»á³öÏÖÖÃÒÉ£¬ÏȲ»¹Ü£¬Ö´ÐÐÏÂÃæµÄÓï¾ä£¨×¢ÒâÐÞ¸ÄÆäÖеÄÊý¾Ý¿âÃû)
6.Íê³ÉºóÒ»°ã¾Í¿ÉÒÔ·ÃÎÊÊý¾Ý¿âÖеÄÊý¾ÝÁË,Õâʱ,Êý¾Ý¿â±¾ÉíÒ»°ã»¹ÒªÎÊÌâ,½â¾ö°ì·¨ÊÇ,ÀûÓÃ
Êý¾Ý¿âµÄ½Å±¾´´½¨Ò»¸öеÄÊý¾Ý¿â,²¢½«Êý¾Ýµ¼½øÈ¥¾ÍÐÐÁË.
USE MASTER
GO
SP_CONFIGURE 'ALLOW UPDATES',1 RECONFIGURE WITH OVERRIDE
GO
UPDATE SYSDATABASES SET STATUS =32768 WHERE NAME='ÖÃÒɵÄÊý¾Ý¿âÃû'
Go
sp_dboption 'ÖÃÒɵÄÊý¾Ý¿âÃû', 'single user', 'true'
Go
DBCC CHECKDB('ÖÃÒɵÄÊý¾Ý¿âÃû')
Go
update sysdatabases set status =28 where name='ÖÃÒɵÄÊý¾Ý¿âÃû'
Go
sp_configure 'allow updates', 0 reconfigure with override
Go
sp_dboption 'ÖÃÒɵÄÊý¾Ý¿âÃû', 'single user', 'false'
Go
 
Ïà¹ØÎĵµ£º
1. ³ÌÐòÈçÏ£º
string str = "Create Database " + "DBname";
string con = "Data Source=10.0.0.249\\sql2005;Initial Catalog=master;Persist Security Info=True;User ID=sa;Password=sa";
&n ......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient; //ÒýÓÃÃüÃû¿Õ¼ä
namespace DAL
{
/*******************************************************************************
&n ......
SQL SERVER 2008 ¸ü¸Ä¸ú×Ù
/*
¿´Ê飬¿´Áª»úÆڼ䡣¡£¡£Ë³´ø°Ñ¿´µ½µÄдÏÂ
ÓëSQL SERVER 2008 CDC Òì²½²¶»ñÊý¾Ý±ä¸üµÄ²»Í¬,¸ü¸Ä¸ú×ÙÊÇͬ²½½ø³Ì,
ÊÇDML(INSERT/UPDATE/DELETE)ÊÂÎñµÄÒ»²¿·Ö,Ëü¿ÉÒÔʹÓÃ×îСµÄCÅÌ´æ´¢
¿ªÏúÀ´Õì²âÊý¾ÝÐеľ»±ä¸ü.ÄÇôËüÒ²¾Í²»ÄÜÏñCDCÄÇÑù¿ÉÒÔÌṩÓû§±íµÄ
ÀúÊ·¸ü¸ÄÐÅÏ¢. ¸ü¸ÄÊÇʹÓÃÒ ......
SQL¸ß¼¶Ê¹ÓÃ
SELECT¸ß¼¶²éѯ
´íÎó´¦Àí
ÊÂÎñ´¦Àí
Êý¾ÝµÄËø¶¨
Óαê
1.SELECT¸ß¼¶²éѯ
Ç°ÃæÒѾ½éÉÜÁËSELECTÓï¾äµÄÓ÷¨£¬±¾½ÚÖ÷Òª½éÉÜÊý¾Ý»ã×Ü¡¢Áª½Ó²éѯ¡¢×Ó²éѯºÍ¹Ø¼ü´ÊUNIONµÄʹÓá£
(1)Êý¾Ý»ã×Ü
Ϊ¾ö²ßÖ§³ÖϵͳÉú³É¾ÛºÏÊÂÎñµÄ»ã×ܱ¨±íÊÇÒ»ÏÔÓ²¢ÇÒÏ൱ÏûºÄ×ÊÔ´µÄ¹¤×÷¡£SQL Server 2000ÌṩÁ½¸öÁé»îÇÒÇ¿´óµÄ×é¼þ ......
1¡¢²éÕÒ±íÖжàÓàµÄÖظ´¼Ç¼£¬Öظ´¼Ç¼ÊǸù¾Ýµ¥¸ö×ֶΣ¨peopleId£©À´ÅжÏ
select * from people
where peopleId in (select peopleId from people group by peopleId having count
(peopleId) >& ......