Hi All,
I am new to MS SQL Server.I am using MS SQL 2000.I have a problem in
creating a table by using Select command.I have table called "test"
and i want to create another table with the same structure and rows.I
tried with the following command
create Table test1 as select * from test;
But it give an syntax error.I have tried the same command in Oracle
but i was working.Does MS SQL 2000 Server supports this kind of Query.
Please help me to solve the problem or any other methods to perform
this operation.
Thanks in Advance
Kevin 2 22726
You can use Query Analyzer to generate the CREATE TABLE statement
automatically from your exsiting table.
CREATE TABLE test1 (col1 INTEGER PRIMARY KEY, col2...)
INSERT INTO test1 (col1, col2,...)
SELECT col1, col2,...
FROM test
You can also use:
SELECT * INTO test1 FROM test
but the CREATE... INSERT method gives you more control over constraints,
etc.
--
David Portas
------------
Please reply only to the newsgroup
--
SELECT * INTO NewTable FROM OldTable
This will create the same structure and take the data with it.
The other option is go to the design of your table, preview a script
of it, and then use this to build the new table (just change the table
name). Once you have the structure of the table, you can create / drop
this as needed within your query (i.e. Create Table ... SELECT
INTO...)
"David Portas" <RE************ *************** *@acm.org> wrote in message news:<hr******* *************@g iganews.com>... You can use Query Analyzer to generate the CREATE TABLE statement automatically from your exsiting table.
CREATE TABLE test1 (col1 INTEGER PRIMARY KEY, col2...)
INSERT INTO test1 (col1, col2,...) SELECT col1, col2,... FROM test
You can also use:
SELECT * INTO test1 FROM test
but the CREATE... INSERT method gives you more control over constraints, etc. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Indraneel Sheorey |
last post by:
Hello,
I want to set up a query in SQL Server that is "grouped by" a variable
PRICE. Since PRICE takes on continuous decimal values, I want to
create deciles based on this variable and then display the average
price in each decile. As background, PRICE is a calculated quantity:
I divide a table field SLS_DLRS by a field SLS_UNTS to get it. I also
want to include an average SLS_UNTS for each decile.
So essentially, I want the result...
|
by: p |
last post by:
WE had a Crystal 8 WebApp using vs 2002 which we upgraded to VS2003. I also
have Crystal 9 pro on my development machine. The web app runs fine on my
dev machine but am having problems deploying. I created the websetup and
built the MSI, have the bundled version. Copied to webserver and ran
Websetup.msi. Said I had to remove old version, which I did, then reran
WebSetup.msi and keeps giving me this error. "The installer was interrupted...
|
by: Patrick.O.Ige |
last post by:
I have a code below and its a PIE & BAR CHART.
The values now are all static but I want to be able to pull the values from
a database.
Can you guys give me some ideas to do this?
Thanks
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Declare your object variables
|
by: cindy |
last post by:
Get data into datatable, add to dataset dsSearch "
Get data into datatable, add to dataset dsSearch
Using In-Memory SQL Engine join the tables and select the filenames from the
join, add to dataset dsSearch
CODE ON
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=3994&lngWId=10
using SQL connection get data from view on sql server, add to dataset dsSearch
|
by: cj |
last post by:
I have lots of tables to copy from one server to another. The new
tables have been created to match the old ones. I practiced with one
table. I created the select command (select * from tableA) and Visual
Basic .NET created an update command--very long as there are a lot of
fields.
Now there are more large tables to copy. Is there an easy way to have
Visual Basic create these update commands itself for the other tables
with out...
| |
by: DC |
last post by:
The problem
I'm using the .NET GridView and FormView objects for the first time and
im getting the error "An OleDbParameter with ParameterName '@ID' is not
contained by this OleDbParameterCollection" whenI try to write a new record.
Delete and Modify work fine its just the add record function causes the
error.
|
by: Arun Srinivasan |
last post by:
I have a problem, I am getting SQL1042N The SQL statement is not
supported. error when I try to create a MQT against a nickname. The
source db is db2 version 9.1 fixpack 4, same as the target db and so
the SQL is definitely supported and both are in windows 2003 server.
Is there a way I could find why this error pops up.
My syntax is like
create mqt1 as
(select col1, col2, ..............., colN from nickname where
<predicate>) data...
|
by: hyperpau |
last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding.
I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com).
Ergo, I will be writing this article intended for those who are in the same level, or maybe lower, of my technical knowledge.
I would be using layman's words, or maybe, my own words as how I understand them, hoping, you will understand it the same way that...
|
by: hyperpau |
last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding.
I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com).
Ergo, I will be writing this article intended for those who are in the same level, or maybe lower, of my technical knowledge.
I would be using layman's words, or maybe, my own words as how I understand them, hoping, you will understand it the same way that...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |