472,988 Members | 2,665 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,988 software developers and data experts.

Createa table like a existing table?

SSG
Hai all

I am new to SLQ server. Can anyone tell me how to create a table that
should look like a existing table fields....

thanx

Dec 27 '05 #1
2 4637
SSG (ss****@gmail.com) writes:
I am new to SLQ server. Can anyone tell me how to create a table that
should look like a existing table fields....


You can do "SELECT * INTO newtbl FROM tbl WHERE 1 = 0". Beware though
that constraints, indexes and triggers are not copied. If you want that
you are better off scripting the table, which you can do by right-clicking
the table in the Object Broswer in Query Analyzer. Even better, have all
your source code under version control. Then copying is even easier.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Dec 27 '05 #2
On Tue, 27 Dec 2005 08:13:25 +0000 (UTC), Erland Sommarskog
<es****@sommarskog.se> wrote:
SSG (ss****@gmail.com) writes:
I am new to SLQ server. Can anyone tell me how to create a table that
should look like a existing table fields....


You can do "SELECT * INTO newtbl FROM tbl WHERE 1 = 0". Beware though
that constraints, indexes and triggers are not copied. If you want that
you are better off scripting the table, which you can do by right-clicking
the table in the Object Broswer in Query Analyzer. Even better, have all
your source code under version control. Then copying is even easier.


Also note that in most cases where you would want to copy a table's design
within the same database, you'd probably be better off doing more
normalization instead.
Dec 27 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: me | last post by:
I would like to add an Identity to an existing column in a table using a stored procedure then add records to the table and then remove the identity after the records have been added or something...
21
by: Dan | last post by:
Hi, just ran into my first instance of a backend Access97 database not compacting. I'm getting the "MSACCESS.EXE has generated errors.." message on compact. I've narrowed it down to the largest...
2
by: Miguelito Bain | last post by:
hi everyone- i inheritrd a database that wasn't designed very well. i'm trying to decide whether or not it is a good idea to add at least 8 more fields to a table that already has existing...
1
by: Michael | last post by:
I have a query that uses two joined tables. The query contains data. I would like to pull in a data drom another table but when I add that table to the query design and make the join,the existing...
6
by: Sven Pran | last post by:
Probably the answer is there just in front of me only awaiting me to discover it, but: 1: I want to build a query that returns all records in one table for which there is no successful "join"...
5
by: premmehrotra | last post by:
I am using Microsoft Access 2000 and Oracle 9.2.0.5 on Windows 2000. When I export a table from Access to Oracle using ODBC I get error: ORA 972 identifier too long I think the error is because...
1
by: deko | last post by:
DoCmd.CopyObject copies data, but I only need structure. I'm trying to clone several tables in my Access 2003 mdb. The goal is to link to a series of Excel spreadsheets and then run various...
3
by: Andrew Clark | last post by:
Hello, I am writing a function that uses two table variables. The structures of both are shown here: DECLARE @workdates TABLE ( conflict CHAR(1), workdate SMALLDATETIME )
1
by: Greg | last post by:
Hi, I need to implement a table in XBRL. Let's assume I have 2 simple tables to define: TABLE 1 col1 col2 row1 A C row2 B D TABLE 2
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
3
SueHopson
by: SueHopson | last post by:
Hi All, I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.