SQL - 使用默认值创建重复表 [英] SQL - Create duplicate table with default valie

查看:109
本文介绍了SQL - 使用默认值创建重复表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友们



我使用


从工资中选择*进入indsalary


用于创建重复表。



根据工资结构创建indsalary,但默认值为没有复制。 为什么?如何复制默认值。



请帮助我



C.Anburose




解决方案


选择* into语句没有这样的功能,只是简单生成表,不包括主键,默认值等


如果要与源表相同,可以生成源表的Create Table脚本,修改表名,键名,约束名称等,首先创建table2,然后使用insert into table2 select * from table1来复制数据。


最好的问候,


亚历


Dear Friends

i use

select * into indsalary from salary

for create a duplicate table.

indsalary is created as per salary structure, but default value is not copied.  why? how can i copy the default value.

Pls help me

C.Anburose

解决方案

Hi,

Select * into statement does not have such a function, just simple to generate the table, does not include the primary key, default value, etc.

If you want to be the same as the source table, you can generate the Create Table script of the source table, modify the table name, key name, constraint name, etc., first create table2, and then use insert into table2 select * from table1 to copy the data.

Best Regards,

Alex


这篇关于SQL - 使用默认值创建重复表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆