SQLÖÐ ³£ÓõĴ¦Àí·½·¨
-- Ò»£º ´¦Àíδ²éµ½µÄ¿ÕÖµ
select
case when exists(select EndPrice from T_stock where BOMSN='0109')
then (select EndPrice from T_stock where BOMSN='0109')
else 0 end
--¶þ£º¸üÐÂ×Ö¶ÎÖµ
--strNum ÊýÁ¿
--strId ÐòºÅ
update T_buy_Pro set CompentNum=isnull(CompentNum,0)+'strNum' ,
Status= case when isnull(BuyNumber,0) > isnull(CompentNum,0)+ 'strNum'
then '²¿·ÖÊÕÁÏ' else 'È«²¿ÊÕÁÏ' end
where BuyProID='strId'
È¥µôСÊýµãÓÐЧÊý×ÖºóÃæµÄËùÓÐ0
decimalÀàÐÍ£¬Ð¡ÊýλÊýÊÇ6룬Èç¹û²åÈëµÄÊý¾ÝΪ2.5£¬Ôò¼ìË÷ʱÏÔʾΪ2.500000
select cast(2.500000 as real)
----------½¨Ò»個º¯數Íê³É-------------
Create Function trun(@i decimal(18,6))
returns varchar(30)
begin
declare @s varchar(30)
set @s=cast(@i as varchar(30))
while len(@s)>0
begin
if cast(substring(rtrim(@s),len(rtrim(@s))-1,1) as int)<>0
begin
set @s=substring(rtrim(@s),1,len(@s)-1)
break
end
set @s=substring(rtrim(@s),1,len(@s)-1)
end
return(@s)
end
----------------------------結Êøº¯數--------
Ïà¹ØÎĵµ£º
´´½¨sqlÊý¾Ý¿â¸´ÖƵķ¢²¼¡¢¶©ÔĵÄÎÊÌâ´¦Àí[ת]
²Ù×÷ʹÓõÄһЩ¼¼ÇÉ(ÊÂÎñ¸´ÖÆÀàÐÍ):
1.ÈçºÎÐÞ¸ÄÒ»¸öÒѾ·¢²¼µÄ±íµÄÊôÐÔ?
½«·¢²¼ËùÓж©ÔÄɾ³ý,(·¢²¼²»ÓÃɾ³ý),¾Í¿ÉÒÔÔÚ·¢²¼ÊôÐÔµÄÏîÄ¿ÖÐÈ¡Ïû±í,È»ºó¾Í
¿ÉÒÔÐÞ¸ ......
--
> ²âÊÔÊý¾Ý£º[tb]
if
object_id
(
'
[tb]
'
)
is
not
null
drop
table
[
tb
]
go
create
table
[
tb
]
(
[
id
]
int
,
[
lx
]
int
)
insert
[
tb
]
select
29
,
2
union
all
select
30
,
3
union
all
sel ......
×ÔÁ¬½ÓÊÇÖ¸Ò»¸ö±íÓëÆä×ÔÉí½øÐÐÁ¬½Ó¡£
¾ÙÒ»¸ö¼òµ¥µÄʵÀý£¬Ò»¸öѧÉú¿Î³Ì³É¼¨±íStudentScore£¬ÆäÖаüÀ¨Ñ§Éú±àºÅ/studentid£¬ËùÑ¡¿Î³Ì/coursename,¿Î³Ì³É¼¨/score
Ñ¡ÔñÿÃſγ̵ÄǰÁ½ÃûѧÉú,²¢½«ËûÐÅÏ¢Êä³ö³öÀ´
´ËʱÄãµÄµÚÒ»·´Ó¦¾ÍÊÇÒª°ÑѧÉú°´ËùÑ¡¿Î³Ì½øÐзÖ×飬Ȼºó±È½Ï»ñµÃÿÃſγÌÀïÃæÇ°Á½Î»µÄѧÉú
·Ö×éµÄ·½Ê½ÓÐgroup b ......
ÈçºÎʵÏÖ¶à¸ö¹Ø¼ü×Ö°´ÕÕ²»Í¬ÅÅÐò¹æÔò½øÐÐÅÅÐòÄØ£¿
ORDER BY×Ó¾äÈÃÊý¾Ý¿â¶Ô²éѯ½á¹ûÅÅÐò£¬ORDER BY×Ӿ䱨Ðë·ÅÔÚ²éѯÓï¾äµÄ½áβ¡£Æä»ù±¾ÓÃ
·¨ÈçÏ£º
SELECT * from Contacts ORDER BY first_name;
Äã¿ÉÒÔ¶Ô¶àÁÐÊý¾ÝÅÅÐò¡£ÓÅÏÈ˳Ðò°´´Ó×óµ½ÓÒÒÀ´Î½µµÍ£¬ËùÒÔ²éѯÓï¾äÖ ......
ÓÉÓÚ³ÌÐòÐèÒª°ÑSQL SERVER ÀïµÄÊý¾Ýµ¼Èëµ½ACCESSÀï.
¸Õ¿ªÊ¼Ê¹ÓÃDataSetÀ´Ñ»·.
Êý¾ÝÁ¿ÉÙµÄʱºò»¹Ëã¿ÉÒÔÓ¦¸¶µÄ¹ýÀ´.
µ«µ±Êý¾Ý¶àµÄʱºò.
»á±¨´í"λÖôíÎó"
ÔÚÍøÉÏËÑѰһ·¬.ÕÒµ½Ò»¸ö·½·¨.
ʹÓÃinsert into openrowset
½Ó×Å´íÎóÒ»¸ö½ÓÒ»¸öµÄÀ´..
"²åÈë´íÎó: ÁÐÃû»òËùÌṩֵµÄÊýÄ¿Óë±í¶¨Ò岻ƥÅä¡£"
"δÄÜÕÒµ½ OLE DB Ì ......