在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
相关文档:
系统环境:Windows 7
软件环境:Visual C++ 2008 SP1 +SQL Server 2005
本次目的:编写一个航空管理系统
这是数据库课程设计的成果,虽然成绩不佳,但是作为我用VC++ 以来编写的最大程序还是传到网上,以供参考。用VC++ 做数据库设计并不容易,但也不是不可能。以下是我的程序界面,后面 ......
Standard Security:
"Data Source=Aron1;Initial
Catalog=pubs;User Id=sa;Password=asdasd;"
- or -
"Server=Aron1;Database=pubs;User
ID=sa;Pass ......
原文地址:http://www.blogjava.net/xingcyx/archive/2007/01/09/92638.html
使用oracle的10046事件跟踪SQL语句
我们在分析应用程序性能问题的时候,更多地需要关注其中SQL语句的执行情况,因为通常应用程序的性能瓶颈会在数据库这边,因此数据库的sql语句是我们优化的重点。利用Oracle的10046事件,可以跟踪应用程序所执 ......
在Where子句中,可以对datetime、char、varchar字段类型的列用Like子句配合通配符选取那些“很像...”的数据记录,以下是可使用的通配符:
% 零或者多个字符
_ 单一任何字符(下划线)
\ 特殊字符
[] 在某一范围内的字符,如 ......
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 ......