易截截图软件、单文件、免安装、纯绿色、仅160KB

在SQL中向多个数据库中插入相同的记录

今天一个朋友问到这个问题,其实很好解决:
declare   @dbname   varchar(50)  
  declare   c_database   cursor   for  
      select   name   from   master.dbo.sysdatabases   where   name   like   '%数据库名%'  
  open   c_database  
  fetch   next   from   c_database   into   @dbname  
  while   @@fetch_status=0  
  begin  
      exec('use   '+@dbname  
            +'   insert   into   表名(字段)   values(''内容'')')  
      fetch   next   from   c_database   into   @dbname  
  end  
  close   c_database  
  deallocate   c_database
go


相关文档:

在SQL SERVER中实现RSA加密算法(第二版)

/***************************************************  
        作者:herowang(让你望见影子的墙)
    日期:2010.1.5
          注:    转载请保留此信息
     ......

SQL Server如何跨实例访问数据库

在我们日常使用SQL Server数据库时,经常遇到需要在实例Instance01中跨实例访问Instance02中的数据。例如在做数据迁移时,如下语句:
insert into Instance01.DB01.dbo.Table01
          select * from Instance02.DB01.dbo.Table01
普通情况下,这样做是不允许的,因为SQ ......

学习 T SQL (1)

基于msdn 详细学习T-SQL (http://msdn.microsoft.com/zh-cn/library/bb510741.aspx)
 Aggregate function--Sum() Two Sample from msdn
USE AdventureWorks;
GO
SELECT Color, SUM(ListPrice), SUM(StandardCost)
from Production.Product
WHERE Color IS NOT NULL
    AND ListPrice != 0.00 ......

SQL learning

Five basic search conditions are summarized here:
1) Comparison test
2) Range test
3) Set membership test
4) Pattern matching test (Like)
     The pattern matching test checks to see whether the data value in a column matches a specified pattern
   % mathes any se ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号