随笔分类 - SQL(存储过程)
摘要:昨天部署网站:www.niyuewo.com时再次遇到错误15023:当前数据库中已存在用户或角色 在把远程服务器上的数据库备份还原到本地机后, 给一个"登录"关联一个"用户"时,发生错误:“错误15023:当前数据库中已存在用户或角色” 为了让大家不再走弯路,所以把原因及解决办法如下:在迁移测试平台数据库的过程中发现,在两台服务器上运行的sql server 服务器之间迁移数据库的之后,会出现一个在源服务器上可以正常的用户在目的服务器上无法登录的情况。几经排常找到了原因与解决方法,因为这个问题与解决方法均比较复杂,所以把这个过程中的一些经验纪录下来与大
阅读全文
摘要:SQL语句导入导出大全 ******* 导出到excel EXEC master..xp_cmdshell 'bcp SettleDB.dbo.shanghu out c:\temp1.xls -c -q -S"GNETDATA/GNETDATA" -U"sa" -P""' /*********** 导入Excel SELECT * FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0', 'Data Source="c:\test.xls&quo
阅读全文
摘要:http://www.cnblogs.com/sunheyubo/admin/txfile:platformres:MsgMgr/msgmgr.htm#http://www.cnblogs.com/sunheyubo/admin/txfile:platformres:MsgMgr/msgmgr.htm#http://www.cnblogs.com/sunheyubo/admin/txfile:platformres:MsgMgr/msgmgr.htm#http://www.cnblogs.com/sunheyubo/admin/txfile:platformres:MsgMgr/msgmgr.
阅读全文
摘要:1、如何查询重复的记录,并取出指定的记录? select * from Table1 t1 where id in (select max(id) from Table1 t2 where t1.id=t2.id)2、如何删除记录中重复的数据? delete from Table1 where id not in (selectid from Table1 t1 where id in (sele...
阅读全文
摘要:http://forum.liehuo.net/thread-2841-1-1.html
阅读全文
摘要:Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->select * into #Temp from OpenRowSet('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;HDR=Yes;IMEX=1;Database=c:\资...
阅读全文
摘要:create view CertAllErrorUserView as select ID=newid(), --为不实际不存在的唯一列 DeptID,State,State1,ErrorCount,SubmitDate, Rate=convert( decimal(20,0),(ErrorCount*1.0/(select count(1) from mms_...
阅读全文
摘要:select * from openrowset('SQLOLEDB','.';'sa';'',[test].[dbo].[Equipment_SB_table])
阅读全文

浙公网安备 33010602011771号