Sql½¨¿â½¨±í
1.½¨¿â
declare @dbName varchar(20),@dataName varchar(2000),@dataPath varchar(2000),@logName varchar(2000),@logPath varchar(2000)
set @dbName='DB_Exam_OnLine_YHK'
set @dataName='DB_Exam_OnLIne_YHK_DB'
set @dataPath='D:\gaoFang\Exam\App_Data\DB_Exam_OnLIne_YHK_DB.mdf'
set @logName='DB_Exam_OnLIne_YHK_LG'
set @logPath='D:\gaoFang\Exam\App_Data\DB_Exam_OnLIne_YHK_LG.ldf'
exec('CREATE DATABASE '+@dbName+' on (name='+@dataName+', FILENAME='''+@dataPath+''') LOG ON (name='+@logName+', FILENAME='''+@logPath+''')')
2.ÅÅÐòʱҪעÒ⣺Èç1£¬11£¬9
µ±Îª×Ö·ûÐÍvarcharÅÅÐòʱΪ£º1£¬11£¬9
µ±ÎªÊýÖµÐÍint,decimal,floatµÈʱÅÅÐòΪ£º1£¬9£¬11
ËùÒÔ×Ö·ûÐ͵ÄÅÅÐò¿ÉÒÔÕâÑùдorder by Convert(decimal,×Ö·ûÐÍÊý¾Ý×Ö¶Î) »òÕßorder by Covert(Interge,×Ö·ûÐÍÊý¾Ý×Ö¶Î)
Ïà¹ØÎĵµ£º
ÓÐЩ³£¼ûµÄÎÊÌâÔÚÂÛ̳Öв»¶Ï³öÏÖ£¬²»·ÁÕûÀíһϡ£
ÒÔÏÂÓï¾äÊÇÔÚSQLServer2005ÉÏʵÏֵģ¬Ò»Ð©Óï¾äÎÞ·¨ÔÚSS2000ÉÏÖ´ÐС£
ÓÐÓÃÖ¸ÊýÊÇÎÒ¸ù¾ÝÕâ¸öÎÊÌâµÄ³£¼û³Ì¶È´òµÄ·Ö£¬½ö¹©²Î¿¼¡£Êµ¼ÊÉÏ£¬µ±ÄãÓöµ½ÁËÕâ¸öÎÊÌ⣬Õâ¸öÎÊÌâÄÄÅÂÔÙÉÙ¼û£¬½â¾ö·½°¸Ò²ÊǷdz£ÓÐÓõġ£
1. Éú³ÉÈô¸ÉÐмǼ
ÓÐÓÃÖ¸Êý£º¡ï¡ï¡ï¡ï¡ï
³£¼ûµÄÎÊÌâÀàÐÍ£º¸ù ......
--¾ÛºÏº¯Êý
use pubs
go
select avg(distinct price) --Ëãƽ¾ùÊý
from titles
where type='business'
go
use pubs
go
select max(ytd_sales) --×î´óÊý
from titles
go
use pubs
go
select min(ytd_sales) --×îÐ¡Ê ......
Æô¶¯ MS SQL SERVER £¨2000 £2008¶¼ÊÊÓã©£º
cmd>net start mssqlserver
Æô¶¯ ·ÇȱʡʵÀý£º
cmd>net start mssql$[instance name]
×¢£ºÃüÁîÐÐÐèÒªÓÐAdministratorȨÏÞ¡£
Í£Ö¹SQLSERVER ·þÎñÆ÷:
cmd>net stop mssqlserver
cmd>net stop mssql$[instance name] ......
sqlȨÏÞ:
´´½¨User:
insert into mysql.user(Host,User,Password)
values("localhost","cordev",password("xasoftorg"));
insert into
mysql.user(Host,User,Password)
values("localhost","corhotfix",password("xasoftorg"));
insert into
mysq ......
ÔÚдsqlÓï¾äʱ£¬Ò»°ã¶¼ÊÇÒ»¾ä½â¾ö£¬´ÓÀ´Ã»Ïë¹ý˵£¬°ÑsqlÓï¾ä²ð¿ªÀ´Ð´¡£
ÀýÈçÏÂÃæÕâ¾ä£º string readstring = "select * from ʵÀý where ʵÀýID='"+eid+"'";
È»ºóÖ´ÐÐ Myconnection();
DataSet ds = new DataSet();
OleD ......