>> 数据表复制

当表目标表存在时:

insert into 目的数据库..表 select * from 源数据库..表  

当目标表不存在时:

select * into 目的数据库..表 from 源数据库..表

复制数据表结构,不复制内容

select *  into 数据库名.dbo.新表名   from  数据库名.dbo.原表名 where 1=0

 

>> 修改数据库显示的时间

--修改前时间
select getdate()

--打开高级系统控制选项
EXEC master.dbo.sp_configure 'show advanced options', 1 RECONFIGURE

--修改执行权限,这样就可以执行修改时间的命令了
EXEC master.dbo.sp_configure 'xp_cmdshell', 1 RECONFIGURE

--修改系统时间
exec master..xp_cmdshell 'date 2008-10-23'
exec master..xp_cmdshell 'time 11:30:15'

--修改后时间
select getdate()

--与数据库所在计算机的时间同步
exec master.dbo.xp_cmdshell 'net time /localhost /set  /Y' 

--同步后时间
select getdate()
View Code

相关文章:

  • 2021-11-29
  • 2022-12-23
  • 2021-07-20
  • 2021-12-03
  • 2022-12-23
  • 2021-08-16
  • 2021-11-27
猜你喜欢
  • 2021-10-04
  • 2021-08-30
  • 2022-12-23
  • 2021-06-17
  • 2021-05-27
  • 2022-02-02
  • 2021-10-30
相关资源
相似解决方案