-
Create table studentinfo select * from studentdata
hi
I want to create table like existing one.
so i wriete statement like that
Create table studentinfo select * from studentdata
but i can't.Any idea for it.
I write it at MS SQL 2000
Another question
I installed MSDE only
I want to attach database using sp_attach_db
how can i do from Visual Basic?
Thanks
pmmw
Last edited by PMMWAN; 07-07-2005 at 11:49 PM.
-
select * into studentinfo from studentdata
>>Create table studentinfo select * from studentdata
-
You can install sql client tools then connect to msde with query analyzer.
-
MSDE comes to OSQL.exe, you can execute sp_attach_db using OSQL
-
Select ... Into has certain issues that you should be aware of. For example, if a column contains all null values, then the select into will fail because SQL will try to creat the new table based on the data in the query result set rather than the underlying schema. This results in it trying to create a field with a size of 0.
A trick to get around this is to supply it criteria that returns 0 records. This forces SQL Server to look at the underlying schema rather than the data.
Select * Into studentinfo
From studentdata
Where 1 = 2
Insert Into studentinfo
Select *
From studentdata
-
Thanks
it's Good idea writing statement like
Select * Into studentinfo
From studentdata
Where 1 = 2
It's more safety.
-
That only copies schema and data over but not index or keys, you may need recreate them on target table.
-
Thanks
Good advice from you
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|