C#同步SQL Server数据库中的数据 1. 先写个sql处理类: using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; using System.Text; namespace PinkDatabaseSync { class DBUtility : IDisposable { private string Server; private string
if exists (select 1 from sysobjects where name = 'sysproperties'and xtype = 'V')begin DROP VIEW syspropertiesend GO CREATE VIEW syspropertiesAS SELECT class AS id,Minor_id AS sMallid,* from sys.extended_properties -------在sql server 2005中获取表
场景: A DB Server位于上海 B DB Server位于广州 现有特殊需求,需要通过数据链接将数据从A服务器表T1数据同步至B表T2 性能测试: 现模拟T1表9000笔数据 方式一:直接将9000笔数据通过A服务器推送至B的T2表,历时6分钟 方式二:由B服务器拉取数据,写入T2表,历时6秒 总结: 远程拉取数据性能远远优于远程推送数据
--office 2003--如果接受数据导入的表已经存在insert into DemoTable select * from OPENROWSET('MICROSOFT.JET.OLEDB.4.0','Excel 5.0;HDR=YES;DATABASE=d:/Demo.xls',sheet1$)--如果导入数据并生成表select * into DemoTable from OPENROWSET('MICROSOFT.JET.OLEDB.4.0','Excel 5.0;HDR=YES;D
顶级干货 用来比较两个数据库之间 表结构,存储过程及视图差异的存储过程,直接复制对应的存储过程,无需改动,直接在数据库中执行(传递要比较的数据库参数)即可 1.两个数据库之间存储过程及视图差异比较的存储过程 --测试脚本 --exec [p_compSPAndView] 'FAMS_PrePROD','FAMS_SIT' SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE?proc [dbo].[p_compSPAndView] @db
表连接 1.select * from student,score --笛卡尔积 2.两个表的连接: 法1:select student.sno, sname, degree from student,score ----当查询的列名两个表中都有时要在列名前面加上'表名.' where student.sno=score.sno 法2:select cno, (select sname from student where student.sno=score.sno),degree from
For rebuilding index, here is also a script to figure out the fragmentation and decide whether rebuilding index is in need: use [database_name] SELECT dbschemas.[name] as 'Schema', dbtables.[name] as 'Table', dbindexes.[name] as 'Index', indexstats.a
SELECT syscolumns.name,systypes.name,syscolumns.isnullable,syscolumns.length FROM syscolumns, systypes WHERE syscolumns.xusertype = systypes.xusertype AND syscolumns.id = object_id('ChildrenCustomer') and syscolumns.name like '%obile'