易截截图软件、单文件、免安装、纯绿色、仅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


相关文档:

航空公司管理系统(VC++ 与SQL 2005)

系统环境:Windows 7
软件环境:Visual C++ 2008 SP1 +SQL Server 2005
本次目的:编写一个航空管理系统
      这是数据库课程设计的成果,虽然成绩不佳,但是作为我用VC++ 以来编写的最大程序还是传到网上,以供参考。用VC++ 做数据库设计并不容易,但也不是不可能。以下是我的程序界面,后面 ......

oracle sql 求种菜时间

-- create by zh
-- n 是作物的时间,x 是希望在几点成熟,返回播种的时间
with t as
(
select 64 n,9 x from dual union all
select 64 n,13 x from dual union all
select 64 n,17 x from dual union all
select 64 n,20 x from dual
)
select '成熟时间:'     || lpad(to_char(n),4,' ' ......

学习 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语句中截取字符串函数的应用


问题一 
有这样的一个问题,数据库中有两个表,分别是Guest,Hotel,即旅客信息表和旅馆信息表,Guest表中有一个旅客编码的字段,这个字段的有20位,它的前10位代表这个旅客所住的旅馆,现在的问题是要根据Guest表中的旅客编码字段信息查到他所住的旅馆的名称和旅馆地址!
问题解决:
SQL SERVER的SQL语句:select ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号