1.查询注释 SELECT A.name AS table_name, B.name AS column_name, C.value AS column_description FROM sys.tables A INNER JOIN sys.columns B ON B.object_id = A.object_id LEFT JOIN sys.extended_properties C ON C.major_id = B.object_id AND C.minor_id = B.column…
执行数据库查询时,有完整查询和模糊查询之分.一般模糊语句如下:SELECT 字段 FROM 表 WHERE 某字段 Like 条件 其中关于条件,SQL提供了四种匹配模式:1.%:表示任意0个或多个字符.可匹配任意类型和长度的字符,有些情况下若是中文,请运用两个百分号(%%)表示.比如 SELECT * FROM [user] WHERE u_name LIKE '%三%'将会把u_name为"张三","张猫三"."三脚猫","唐三藏&…
一.问题 用以下sql语句查询数据,结果为空 SELECT a.ID , a.Sub_Project_Name , a.Sub_Project_Type FROM TB_KYSubProject a WHERE a.ID NOT IN ( SELECT DISTINCT c.SubprojectID FROM TB_KYGrogramme c WHERE ISNULL(c.Belong_Programme, '') <> '' AND c.Belong_Programme IN ( SELEC…
在开发的过程中,遇到过not in 始终查询不到数据问题 select * from T_CustomerInfo where CustomerID not in (select CustomerID from T_OrderInfo) 后来使用not exists查询 select * from T_CustomerInfo a where not exists (select CustomerID from T_OrderInfo where CustomerID=a.CustomerID)…