Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

SQLÓï¾ä´´½¨Êý¾Ý¿â

1.create database dataname
ÕâÊÇ´´½¨Êý¾Ý¿â×î¼òµ¥µÄ·½·¨£®Êý¾Ý¿âµÄ¸÷¸öÊôÐÔ¶¼ÊÇĬÈÏ£®ÈçÊý¾Ý¿âÎļþÓëÈÕÖ¾Îļþ´æ´¢Ä¿Â¼£®Êý¾Ý¿â´óСµÈ£®
ÏÂÃæ½éÉÜϳ£Óþö¶¨Êý¾Ý¿âÊôÐÔµÄ×Ӿ䣮
on:¼òµ¥Àí½âΪ¶¨Òå´æ´¢Êý¾Ý¿âÎļþµÄλÖ㬿´ÏÂÃæ´úÂ룮
filename:Êý¾Ý¿âµÄÂß¼­±ðÃû
size:Êý¾Ý¿â³õʼ´óС
maxsize:Êý¾Ý¿â³õ´óÈÝÁ¿
filegrowth:Êý¾Ý¿âÿ´ÎÔö¼ÓµÄÈÝÁ¿£®
log on:¼òµ¥Àí½âΪ¶¨Òå´æ´¢Êý¾Ý¿âÈÕÖ¾ÎļþµÄλÖã®
¿´´´½¨´úÂ룺
create database Accounting
on(name='AccountingName',
filename='F:\×ܽá\Sql\´´½¨ºÍÐÞ¸ÄÊý¾Ý±í\Accounting.mbdf',
size=10mb,
maxsize=50mb,
filegrowth=5mb)
log on(name='AccountingLog',
filename='F:\×ܽá\Sql\´´½¨ºÍÐÞ¸ÄÊý¾Ý±í\Accounting.log',
size=10mb,
maxsize=50mb,
filegrowth=5mb)
ÉÏÃæ˵µ½ÁË¡¡filegrowth:Êý¾Ý¿âÿ´ÎÔö¼ÓµÄÈÝÁ¿¡¡½áºÏ´úÂëÀ´Ëµ£®¾ÍÊdzõʼÊý¾Ý¿â´óСΪ10mb.µ±Êý¾Ý¿âÈÝÁ¿Òª³¬³öʱ£®Ëû»á×Ô¶¯Ôö¼Ó5mb£®Õâ»á¾ÍÊÇ15mb´óС£®×î´óµ½50mb
create database song on
(name=ktvdata,filename='D:\database\ktvdata.mdf',
size=8MB,maxsize=9MB,filegrowth=100KB)
log on
(name=ktvdata_log,filename='D:\database\ktvdata.ldf',
size=9MB,maxsize=10MB,filegrowth=100KB)
go
2. ʹÓÃALTER DATABASEÓï¾äÐÞ¸ÄÊý¾Ý¿â
Àý4-3¡¡½«Á½¸öÊý¾ÝÎļþºÍÒ»¸öÊÂÎñÈÕÖ¾ÎļþÌí¼Óµ½testÊý¾Ý¿âÖС£
³ÌÐòÇåµ¥ÈçÏ£º
ALTER DATABASE Test
ADD FILE
(NAME = Test1, FILENAME='c:\Program Files\Microsoft SQL Server\MSSQL\Data\test1.ndf', SIZE =
5MB, MAXSIZE = 100MB, FILEGROWTH = 5MB),
(NAME = Test2, FILENAME='c:\Program Files\Microsoft SQL Server\MSSQL\Data\test2.ndf', SIZE =
3MB, MAXSIZE = 10MB, FILEGROWTH = 1MB)
GO
ALTER DATABASE Test
 ADD LOG FILE ( NAME = testlog1, FILENAME='c:\Program Files\Microsoft SQL
Server\MSSQL\Data\testlog1.ldf',  SIZE = 5MB,  MAXSIZE = 100MB,  FILEGROWTH = 5MB)
GO
3¡¢ÖØÃüÃûtestΪdemo
  sp_renamedb 'test','demo'
4. ɾ³ýÊý¾Ý¿â£º drop database song
go


Ïà¹ØÎĵµ£º

½«excelÎļþÖеÄÊý¾Ýµ¼Èëµ¼³öÖÁSQLÊý¾Ý¿âÖÐ

µ¼Èë
Èç¹û±íÒÑ´æÔÚ£¬SQLÓï¾äΪ£º
insert into aa select * from OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0',
'Data Source=D:\OutData.xls;Extended Properties=Excel 8.0')...[sheet1$]
ÆäÖУ¬aaÊDZíÃû£¬D:\OutData.xlsÊÇexcelµÄȫ·¾¶ sheet1ºó±ØÐë¼ÓÉÏ$
Èç¹û±í²»´æÔÚ£¬SQLÓï¾äΪ£º
SELECT * INTO aa from OPENDAT ......

SQLÓë¹ý³Ì»¯³ÌÐòÉè¼ÆÓïÑÔ

SQLÓë¹ý³Ì»¯³ÌÐòÉè¼ÆÓïÑÔ
                   
   
SQLÊÇÒ»ÖÖµäÐ͵ķǹý³Ì»¯³ÌÐòÉè¼ÆÓïÑÔ£¬ÕâÖÖÓïÑÔµÄÌصãÊÇ£º
Ö»Ö¸¶¨ÄÄЩÊý¾Ý±»²Ù×Ý£¬ÖÁÓÚ¶ÔÕâЩÊý¾ÝÒªÖ´ÐÐÄÄЩ²Ù×÷£¬ÒÔ¼°Õâ
Щ²Ù×÷ÊÇÈçºÎ
Ö´ÐÐµÄ ......

SQL Server·þÎñÆ÷Ãû³ÆÓëĬÈÏʵÀýÃû²»Ò»ÖµÄÐÞ¸´·½·¨

Ô­Òò·ÖÎö:
SERVERPROPERTY º¯ÊýµÄ ServerName ÊôÐÔÓë@@SERVERNAME ·µ»ØÏàËƵÄÐÅÏ¢¡£ServerName ÊôÐÔÌṩWindows ·þÎñÆ÷ºÍʵÀýÃû³Æ£¬Á½Õß¹²Í¬¹¹³ÉΨһµÄ·þÎñÆ÷ʵÀý£»@@SERVERNAME Ìṩµ±Ç°ÅäÖõı¾µØ·þÎñÆ÷Ãû³Æ¡£
Èç¹û°²×°Ê±Î´¸ü¸ÄĬÈÏ·þÎñÆ÷Ãû³Æ£¬Ôò ServerName ÊôÐÔºÍ @@SERVERNAME ·µ»ØÏàͬµÄÐÅÏ¢¡£Èç¹ûÔÚ°²×°Ê±Òѽ«±¾µ ......

SQL Server ÖйØÓÚEXCEPTºÍINTERSECTµÄÓ÷¨

ÊìÁ·Ê¹ÓÃSQL ServerÖеĸ÷ÖÖÓ÷¨»á¸ø²éѯ´øÀ´ºÜ¶à·½±ã¡£½ñÌì¾Í½éÉÜÒ»ÏÂEXCEPTºÍINTERSECT¡£×¢Òâ´ËÓï·¨½öÔÚSQL Server 2005¼°ÒÔÉÏ°æ±¾Ö§³Ö¡£
EXCEPTÊÇÖ¸ÔÚµÚÒ»¸ö¼¯ºÏÖдæÔÚ£¬µ«ÊDz»´æÔÚÓÚµÚ¶þ¸ö¼¯ºÏÖеÄÊý¾Ý¡£
INTERSECTÊÇÖ¸ÔÚÁ½¸ö¼¯ºÏÖж¼´æÔÚµÄÊý¾Ý¡£
²âÊÔÈçÏ£º
create table t1(id int,mark char(2))
go
create ta ......

SQL Server Ë÷Òý½á¹¹¼°ÆäʹÓ㨶þ£©

SQL Server Ë÷Òý½á¹¹¼°ÆäʹÓ㨶þ£©
×÷Õߣºfreedk
Ò»¡¢ÉîÈëdz³öÀí½âË÷Òý½á¹¹
¸ÄÉÆSQLÓï¾ä
¡¡¡¡ºÜ¶àÈ˲»ÖªµÀSQLÓï¾äÔÚSQL SERVERÖÐÊÇÈçºÎÖ´Ðеģ¬ËûÃǵ£ÐÄ×Ô¼ºËùдµÄSQLÓï¾ä»á±»SQL SERVERÎó½â¡£±ÈÈ磺
select * from table1 where name=''zhangsan'' and tID > 10000
ºÍÖ´ÐÐ:
select * from table1 where tID ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ