ÎÒÏë×÷ÕâÑùµÄÒ»¸ö²éѯ£º
select * from table where name.length>10
ÎÒÏë×÷ÕâÑùµÄÒ»¸ö²éѯ£¬¿ÉÊÇÕâÑùµÄ²éѯÊDz»¿ÉÒÔ£¬Ó¦¸ÃÔõÑùʵÏÖÕâÑùµÄ¹¦ÄÜÄØ£¿
select * from table where len(name) > 10
SQL code:
select * from [table] where len(name)>10
select * from table where len(name) > 10
--Èç¹û ......
ÎÒÊý¾Ý¿âÓÐÌõ¼Ç¼ÊÇ 2010-4-11 13£º00£º00
ÎÒ²éѯµÄÌõ¼þÊÇ2010-4-11µÄËùÓмǼ
sql: select * from sales where saleDate = '2010-4-11'
ÕâÑùµÄ»°Ê²Ã´¶¼²é²»µ½£¬Ó¦¸ÃÔõôд
Çó¸ßÊÖ½â´ð!!
sql: select * from sales where convert(nvarchar(10),saleDate,120) = '2010-04-11'
sql Óï¾äÓÃconvertת»»³É ÄêÔÂÈÕ ¸ñ ......
Êý¾Ý¿âÒ»×Ö¶Î timestamp ÀàÐÍ firstTime 2010-01-01 13:25:26.0
ÔÚ²éѯµÄʱºòÐèÒª°ÑÕâ¸ö×Ö¶Îת»»³É 2010-01-01 ±ÈÈçÊÇ
select date£¨firstTime£© from aa where date£¨firstTime£©='2010-04-01'
Êý¾Ý¿â°æ±¾ÊÇ 8.1 ÔÚv9,5µÄʱºòÎÒ¿ÉÒÔÖ±½ÓÓà varchar_format(fir ......
SQL code:
ÓÐÈý¸ö±í£¬ÒµÎñ±í(Business),±¨Ãû±í(learn),¿ÆÄ¿±í(subject)
Create table Business
(
id varchar(50) primary key,
bName varchar(100)--ÒµÎñÃû
)
insert Business
select 1,'µÚÒ»¸öÒµÎñ' union
select 2,'µÚ¶þ¸öÒµÎñ'
---------
Create Table Subject
(
id int identity primary key,
n ......
ÓÐÕâôһÕÅ±í£º
SORDER KOTECD JSTSTM JSTETM WAREHUSFG(Èë¿â״̬)
04113510 2025 2010-04-03 11:12:00 2010-04-03 11:12:00 1
04113510 2026 2010-04-03 11:36:00 2010-04-03 11:36:00 1
04113511 2015 2010-04-03 02:10:00 2010-04-03 02:10:00 1
04113511 2025 2010-04- ......
SQL code:
@tb varchar(255)
select * from @tb
²»ÄÜÓÃexec·½·¨À´ÊµÏÖ,execÎÒ×Ô¼º»á¡£ÇëÎÊÓÃSQLÓï¾äfromºóÃæÓ¦¸ÃÔõôÑùʵÏÖ£¿
±íÃû¶¯Ì¬ ²»ÓÃexec¾ÍÓÃexec sp_executesql
ÒýÓÃ
SQL code
@tb varchar(255)
select * from @tb
²»ÄÜÓÃexec·½·¨À´ÊµÏÖ,execÎÒ×Ô¼º»á¡£ÇëÎÊÓÃSQLÓï¾äfromºóÃæÓ¦¸ÃÔõôÑùʵÏÖ£¿
µ±± ......