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

Sqlº¯Êý´óÈ«

--¾ÛºÏº¯Êý
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) --×îСÊý
from titles
go
use pubs
go
select type,sum(price),sum(advance)  --ÇóºÍ
from titles
group by type
order by type
go
use pubs
go
select count(distinct city)  --Çó¸öÊý
from authors
go
use pubs
go
select stdev(royalty) --·µ»Ø¸ø¶¨±í´ïʽÖÐËùÓÐÖµµÄͳ¼Æ±ê׼ƫ²î
from titles
go
use pubs
go
select stdevp(royalty) --·µ»Ø±í´ïʽÖÐËùÓÐÖƵÄÌî³äͳ¼Æ±ê׼ƫ²î
from titles
go
use pubs
go
select var(royalty) --·µ»ØËùÓÐÖµµÄͳ¼Æ·½²î
from titles
go
use pubs
go
select varp(royalty) --·µ»ØËùÓÐÖµµÄÌî³äµÄͳ¼Æ·½²î
from titles
go
--Êýѧº¯Êý
select sin(23.45),atan(1.234),rand(),PI(),sign(-2.34) --ÆäÖÐrandÊÇ»ñµÃÒ»¸öËæ»úÊý
--ÅäÖú¯Êý
SELECT @@VERSION --»ñÈ¡µ±Ç°Êý¾Ý¿â°æ±¾
SELECT @@LANGUAGE --µ±Ç°ÓïÑÔ
--ʱ¼äº¯Êý
select getdate() as 'wawa_getdate' --µ±Ç°Ê±¼ä
select getutcdate() as 'wawa_getutcdate' --»ñÈ¡utcʱ¼ä
select day(getdate()) as 'wawa_day' --È¡³öÌì
select month(getdate()) as 'wawa_month' --È¡³öÔÂ
select year(getdate()) as 'wawa_year' --È¡³öÄê
select dateadd(d,3,getdate()) as wawa_dateadd --¼ÓÈýÌì,×¢Òâ'd'±íʾÌì,'m'±íʾÔÂ,'yy'±íʾÄê,ÏÂÃæÒ»Ñù
select datediff(d,'2004-07-01','2004-07-15') as wawa_datediff --¼ÆËãÁ½¸öʱ¼äµÄ²î
select datename(d,'2004-07-15') as wawa_datename --È¡³öʱ¼äµÄijһ²¿·Ö
select datepart(d,getdate()) as wawa_datepart  --È¡³öʱ¼äµÄijһ²¿·Ö,ºÍÉÏÃæµÄÄǸö²î²»¶à
--×Ö·û´®º¯Êý
select ascii(123) as '123',ascii('123') as '"123"',ascii('abc') as '"abc"' --ת»»³ÉasciiÂë
select char(123),char(321),char(-123) --¸ù¾Ýasciiת»»³É×Ö·û
select lower('ABC'),lower('Abc'),upper('Abc'),upper('abc') --ת»»´óСд
select str(123.45,6,1), str(123.45,2,2) --°ÑÊýֵת»»³É×Ö·û´®
select ltrim('     "×ó±ßûÓпոñ"')  --È¥¿Õ¸ñ
select rtrim('"ÓÒ±ßûÓпոñ"     ') --È¥¿


Ïà¹ØÎĵµ£º

sql server 2005 Óû§È¨ÏÞ

ÒªÏë³É¹¦·ÃÎÊ SQL Server Êý¾Ý¿âÖеÄÊý¾Ý£¬ÎÒÃÇÐèÒªÁ½¸ö·½ÃæµÄÊÚȨ£ºÒ»¡¢»ñµÃ×¼ÐíÁ¬½Ó SQL Server ·þÎñÆ÷µÄȨÀû£»¶þ¡¢»ñµÃ·ÃÎÊÌض¨Êý¾Ý¿âÖÐÊý¾ÝµÄȨÀû£¨select, update, delete, create table ...£©¡£¼ÙÉ裬ÎÒÃÇ×¼±¸½¨Á¢Ò»¸ö dba Êý¾Ý¿âÕÊ»§£¬ÓÃÀ´¹ÜÀíÊý¾Ý¿â mydb¡£
1. Ê×ÏÈÔÚ SQL Server ·þÎñÆ÷¼¶±ð£¬´´½¨µÇ½ÕÊ»§£¨creat ......

ÈçºÎ¼ì²éSQL Server CPUÆ¿¾±

--¼ì²âCPUѹÁ¦µÄÒ»¸ö·½·¨ÊǼÆËãÔËÐÐ״̬ÏµĹ¤×÷½ø³ÌÊýÁ¿£¬
--ͨ¹ýÖ´ÐÐÈçϵÄDMV²éѯ¿ÉÒԵõ½Õâ¸öÐÅÏ¢
SELECT COUNT(*) AS workers_waiting_for_cpu,t2.scheduler_id
from sys.dm_os_workers AS t1, sys.dm_os_schedulers AS t2
WHERE t1.state='RUNNABLE' AND 
t1.scheduler_address = t2.scheduler_address A ......

How To Use Dynamic Sql in Sql Server ?

How To Use Dynamic Sql in Sql Server ?
 
¶¯Ì¬SQL ÔÚsql server ProcedureÖеÄÓ¦ÓÃ
 
 
Create PROCEDURE [dbo].[Proc_Get_Serial_No]
        (
         @Table_Name varchar(20),
      ......

SQL Server 2000 ¡°Ê¼þ̽²éÆ÷¡±µÄ¼òµ¥Ê¹ÓÃ

1¡¢ÔÚ°²×°ÓÐSQL SERVER 2000µÄµçÄÔÉÏ´ò¿ª“ʼþ̽²éÆ÷”£¬²Ù×÷Èçͼ£º
 
2¡¢Ôړʼþ̽²éÆ÷”ÖÐн¨Ò»¸ö¸ú×Ù£ºÎļþ/н¨/¸ú×Ù
 
3¡¢ÊäÈëÁ¬½Ó·þÎñÆ÷µÄÃØÃÜ£¬×¢ÒâÊÇU8µÄÊý¾Ý·þÎñÆ÷£¬¿ÉÒÔ¸ù¾Ýʵ¼ÊÐÞ¸ÄIPµØÖ·¡£
 
4¡¢¸ü¸Ä¹ýÂËÉèÖ㺿ÉÒÔÔÚ¡¾Îļþ/ÊôÐÔ¡¿´ò¿ªÕâ¸ö¶Ô»°¿ò£¬µ«ÊÇÒª¸ü¸Ä£¬Ê× ......

SQL Server µ¼Èë/µ¼³ö½Ì³Ì

SQL Server µ¼Èë/µ¼³ö½Ì³Ì
¸ü¶àÇë²é¿´£º http://faq.gzidc.com/index.php?option=com_content&task=category&sectionid=12&id=21&Itemid=43
1¡¢´ò¿ª±¾µØÆóÒµ¹ÜÀíÆ÷£¬ÏÈ´´½¨Ò»¸öSQL Server×¢²áÀ´Ô¶³ÌÁ¬½Ó·þÎñÆ÷¶Ë¿ÚSQL Server¡£
²½ÖèÈçÏÂͼ£º
ͼ1:
2¡¢µ¯³ö´°¿ÚºóÊäÈëÄÚÈÝ¡£"×ÜÊÇÌáʾÊäÈëµÇ½ÃûºÍÃÜÂë" ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ