随笔分类 -  SQL-SERVER

摘要:举例说明[存储过程],[视图]和[自定义函数]的应用场合. 1、需举例说明三种技术的应用场合,为什么选择这种而不是另外两种. 要根据实际情况,做适当的选择,所以不能定性那一种,也没有定性说一定在某场合使用某种技术 存储过程能用动态语句,能更新表,可以传递参数,可以是返回结果集,也可以是一个数据处理过程 视图能创建索引,但只限于用一个SQL语句能实现的东西,固定是返回结果集 函数可以返回表/值,但不... 阅读全文
posted @ 2009-07-14 12:03 Amo 阅读(253) 评论(0) 推荐(0)
摘要:某表名为tb 主键为id,自动增长,但是其中ID有缺失(本来应该是123456……,现在136……)现在要重新排序主键 语句如下select *,newid=identity(int,1,1) intotemp from tbtruncate table tbinsert tb(id,...)select id,... from tempdrop t... 阅读全文
posted @ 2009-07-14 11:47 Amo 阅读(314) 评论(0) 推荐(0)
摘要:测试环境及同步要求: 有数据库服务器srv1和srv2,两台电脑能互相访问,有数据 srv1.库名..author有字段:id,name,phone, srv2.库名..author有字段:id,name,telphone,adress 要求: srv1.库名..author增加记录则srv1.库名..author记录增加 srv1.库名..author的phone字段更新,则srv1.库名..a... 阅读全文
posted @ 2008-06-23 14:15 Amo 阅读(2168) 评论(0) 推荐(0)
只有注册用户登录后才能阅读该文。
posted @ 2008-06-16 10:57 Amo 阅读(21) 评论(0) 推荐(0)
只有注册用户登录后才能阅读该文。
posted @ 2008-05-21 17:16 Amo 阅读(14) 评论(1) 推荐(0)
摘要:CREATE VIEW gavininternet.v_Products AS SELECT GroupProductID AS ProductID, ProductNum, ProductName AS [Name], ImageURL = gavininternet.GetGroupProdcutMainImage(ProductNum), [Description], ... 阅读全文
posted @ 2008-05-15 11:15 Amo
摘要:由于text类型的字段内容比较多,想显示比较多的时候使用下面这个语句 declare @amo varchar(8000) select @amo =(select Convert(varchar(8000), 类型为text的列名) from 表 where 条件) print @amo 阅读全文
posted @ 2008-04-21 14:00 Amo
摘要:-----引用----- 文章后台做了一个导出Excel文档的功能,现将里面的主要代码提取出来于大家分享 xls.asp ">下载 downfile.asp 阅读全文
posted @ 2008-01-17 14:04 Amo 阅读(1922) 评论(0) 推荐(0)
摘要:ALTER PROCEDURE gavininternet.changename @OldOwner as NVARCHAR(128),--参数原所有者 @NewOwner as NVARCHAR(128)--参数新所有者 AS DECLARE @Name as NVARCHAR(128) DECLARE @Owner as NVARCHAR(128) DECLARE @Owner... 阅读全文
posted @ 2008-01-07 14:04 Amo 阅读(257) 评论(0) 推荐(0)
摘要:举例: declare @ReturnValue int exec pub_Members_Insert 'malicious','123','123@11.com','123','123','123','http://we1w.com','123','123',@ReturnValue output print @ReturnValue 阅读全文
posted @ 2007-12-27 11:59 Amo 阅读(328) 评论(0) 推荐(0)