摘要: SELECT case when not exists(SELECT Cons_Date FROM sbcHisMaster WHERE HisTypeNO='L' AND ProductSN ='M7D2028') THEN (SELECT Cons_Date FROM sbcHisMaster WHERE HisTypeNO='Y' AND ProductSN ='... 阅读全文
posted @ 2013-03-13 09:38 忙碌在路上 阅读(1021) 评论(0) 推荐(0) 编辑
摘要: create table employee (empid int ,deptid int ,salary decimal(10,2)) insert into employee values(1,10,5500.00) insert into employee values(2,10,4500.00) insert into employee values(3,20,1900.00... 阅读全文
posted @ 2013-01-10 11:36 忙碌在路上 阅读(284) 评论(0) 推荐(0) 编辑
摘要: --得到数据库中所有用户表 Select [name] from sysObjects Where xtype='U'and [name]<>'dtproperties' Order By [name] --得到数据库中所有用户视图 Select [name] From sysObjects Where xtype='V' And [name]<>'syssegments' And... 阅读全文
posted @ 2012-12-20 14:22 忙碌在路上 阅读(745) 评论(0) 推荐(0) 编辑
摘要: select c_gcode,c_barcode,c_name,c_price_disc,c_price,c_status from tb_gds where ( c_price like '%._[1,2,3,4,5,6,7,8,9]%' or c_price_disc like '%._[1,2,3,4,5,6,7,8,9]%' )and c_weigh='否' and c_stat... 阅读全文
posted @ 2012-12-12 09:45 忙碌在路上 阅读(2221) 评论(0) 推荐(0) 编辑
摘要: 使用 RAISERROR 与 PRINT 相比,RAISERROR 在把消息返回给应用程序方面的功能更强大。RAISERROR 能以下列方式中的任意一种返回消息: 已通过 sp_addmessage 系统存储过程添加到 master.dbo.sysmessages 上的由用户定义的错误信息。 在 RAISERROR 语句中指定的消息字符串。 RAISERROR 也有 PRI... 阅读全文
posted @ 2012-10-07 09:05 忙碌在路上 阅读(252) 评论(0) 推荐(0) 编辑
摘要: declare @name varchar(8000) declare cursor_a cursor for select name from sysobjects where xtype='U' open cursor_a fetch next from cursor_a into @name while @@fetch_status=0 begin e... 阅读全文
posted @ 2012-09-29 15:51 忙碌在路上 阅读(237) 评论(0) 推荐(0) 编辑
摘要: len 主要计算的是字符数量,比如’aabbc’是6个字符,那么’钓鱼岛是中国的’是7个字符,么’钓鱼岛是中国的aabbcc’就是13个字符, 而datalength主要计算的是字节数,注意是字节,一个汉字是2个字节哦,字母是1个字节哦,那么’钓鱼岛是中国的’就是14个字节了,对吧,’钓鱼岛是中国的aabbcc’就是14字节加6字节等于20字节了。 阅读全文
posted @ 2012-09-27 10:28 忙碌在路上 阅读(178) 评论(0) 推荐(0) 编辑
摘要: drop table tb create table tb(时间 datetime , 金额 int) insert into tb values('2007-1-1 10:00:23' , 8 ) insert into tb values('2007-1-1 10:01:24' , 4 ) insert into tb values('2... 阅读全文
posted @ 2012-08-20 08:31 忙碌在路上 阅读(196) 评论(0) 推荐(0) 编辑
摘要: 我现有一表名为: product1,字段内容如下: productID productName price num 101 商品1 2.15 2 112 商品2 5.5 5 203 商品3 4.15 8 101 商品1 2.15 5 一个表为product2,字段内容如下... 阅读全文
posted @ 2012-05-23 15:34 忙碌在路上 阅读(1087) 评论(0) 推荐(0) 编辑
摘要: SQL Server FOR XML PATH 语句的应用 经常在论坛看到高手使用了 for xml path,由于是搜索一下,记录了详细的使用方法。 在SQL Server中利用 FOR XML PATH 语句能够把查询的数据生成XML数据,下面是它的一些应用示例。 DECLARE @TempTable table(UserID int , UserName nvarchar(5... 阅读全文
posted @ 2012-04-21 17:24 忙碌在路上 阅读(2737) 评论(0) 推荐(1) 编辑