Showing posts with label adatabase. Show all posts
Showing posts with label adatabase. Show all posts

Thursday, March 8, 2012

Copying data and indexes

Hi everyone!
How can I do to copy the data and the indexes from an existing table on a
database to a new table in another database?
I've tried with select * into base1.table1 from base2.table2, but it only
copy the data and not the indexes.
Can I do it by code? I'm trying to avoid the use of DTS.
Thanks.
Jaime Lucci
You would have to precreate the table on the destination server/database
with the indexes in place and then do an insert select like this
insert into base1..table1
select * from base2..table2
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Jaime Lucci" <jaimelucci@.hotmail.com> wrote in message
news:Oj%23$5Yr6FHA.2816@.tk2msftngp13.phx.gbl...
> Hi everyone!
> How can I do to copy the data and the indexes from an existing table on a
> database to a new table in another database?
> I've tried with select * into base1.table1 from base2.table2, but it only
> copy the data and not the indexes.
> Can I do it by code? I'm trying to avoid the use of DTS.
> Thanks.
> Jaime Lucci
>
|||Can I "read" by code the index of the table to preceate it in the
destination database?
"Hilary Cotter" <hilary.cotter@.gmail.com> wrote in message
news:e25bpkr6FHA.476@.TK2MSFTNGP15.phx.gbl...[vbcol=seagreen]
> You would have to precreate the table on the destination server/database
> with the indexes in place and then do an insert select like this
> insert into base1..table1
> select * from base2..table2
> --
> Hilary Cotter
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602.html
> Looking for a FAQ on Indexing Services/SQL FTS
> http://www.indexserverfaq.com
> "Jaime Lucci" <jaimelucci@.hotmail.com> wrote in message
> news:Oj%23$5Yr6FHA.2816@.tk2msftngp13.phx.gbl...
a[vbcol=seagreen]
only
>
|||sp_help tablename is good. You can use the results of this to build the
index.
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Jaime Lucci" <jaimelucci@.hotmail.com> wrote in message
news:uK$DPor6FHA.1720@.TK2MSFTNGP09.phx.gbl...
> Can I "read" by code the index of the table to preceate it in the
> destination database?
> "Hilary Cotter" <hilary.cotter@.gmail.com> wrote in message
> news:e25bpkr6FHA.476@.TK2MSFTNGP15.phx.gbl...
> a
> only
>

Copying data and indexes

Hi everyone!
How can I do to copy the data and the indexes from an existing table on a
database to a new table in another database?
I've tried with select * into base1.table1 from base2.table2, but it only
copy the data and not the indexes.
Can I do it by code? I'm trying to avoid the use of DTS.
Thanks.
Jaime Lucci
You would have to precreate the table on the destination server/database
with the indexes in place and then do an insert select like this
insert into base1..table1
select * from base2..table2
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Jaime Lucci" <jaimelucci@.hotmail.com> wrote in message
news:Oj%23$5Yr6FHA.2816@.tk2msftngp13.phx.gbl...
> Hi everyone!
> How can I do to copy the data and the indexes from an existing table on a
> database to a new table in another database?
> I've tried with select * into base1.table1 from base2.table2, but it only
> copy the data and not the indexes.
> Can I do it by code? I'm trying to avoid the use of DTS.
> Thanks.
> Jaime Lucci
>
|||Can I "read" by code the index of the table to preceate it in the
destination database?
"Hilary Cotter" <hilary.cotter@.gmail.com> wrote in message
news:e25bpkr6FHA.476@.TK2MSFTNGP15.phx.gbl...[vbcol=seagreen]
> You would have to precreate the table on the destination server/database
> with the indexes in place and then do an insert select like this
> insert into base1..table1
> select * from base2..table2
> --
> Hilary Cotter
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602.html
> Looking for a FAQ on Indexing Services/SQL FTS
> http://www.indexserverfaq.com
> "Jaime Lucci" <jaimelucci@.hotmail.com> wrote in message
> news:Oj%23$5Yr6FHA.2816@.tk2msftngp13.phx.gbl...
a[vbcol=seagreen]
only
>
|||sp_help tablename is good. You can use the results of this to build the
index.
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Jaime Lucci" <jaimelucci@.hotmail.com> wrote in message
news:uK$DPor6FHA.1720@.TK2MSFTNGP09.phx.gbl...
> Can I "read" by code the index of the table to preceate it in the
> destination database?
> "Hilary Cotter" <hilary.cotter@.gmail.com> wrote in message
> news:e25bpkr6FHA.476@.TK2MSFTNGP15.phx.gbl...
> a
> only
>

Copying data and indexes

Hi everyone!
How can I do to copy the data and the indexes from an existing table on a
database to a new table in another database?
I've tried with select * into base1.table1 from base2.table2, but it only
copy the data and not the indexes.
Can I do it by code? I'm trying to avoid the use of DTS.
Thanks.
Jaime Lucci
You would have to precreate the table on the destination server/database
with the indexes in place and then do an insert select like this
insert into base1..table1
select * from base2..table2
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Jaime Lucci" <jaimelucci@.hotmail.com> wrote in message
news:Oj%23$5Yr6FHA.2816@.tk2msftngp13.phx.gbl...
> Hi everyone!
> How can I do to copy the data and the indexes from an existing table on a
> database to a new table in another database?
> I've tried with select * into base1.table1 from base2.table2, but it only
> copy the data and not the indexes.
> Can I do it by code? I'm trying to avoid the use of DTS.
> Thanks.
> Jaime Lucci
>
|||Can I "read" by code the index of the table to preceate it in the
destination database?
"Hilary Cotter" <hilary.cotter@.gmail.com> wrote in message
news:e25bpkr6FHA.476@.TK2MSFTNGP15.phx.gbl...[vbcol=seagreen]
> You would have to precreate the table on the destination server/database
> with the indexes in place and then do an insert select like this
> insert into base1..table1
> select * from base2..table2
> --
> Hilary Cotter
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602.html
> Looking for a FAQ on Indexing Services/SQL FTS
> http://www.indexserverfaq.com
> "Jaime Lucci" <jaimelucci@.hotmail.com> wrote in message
> news:Oj%23$5Yr6FHA.2816@.tk2msftngp13.phx.gbl...
a[vbcol=seagreen]
only
>
|||sp_help tablename is good. You can use the results of this to build the
index.
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Jaime Lucci" <jaimelucci@.hotmail.com> wrote in message
news:uK$DPor6FHA.1720@.TK2MSFTNGP09.phx.gbl...
> Can I "read" by code the index of the table to preceate it in the
> destination database?
> "Hilary Cotter" <hilary.cotter@.gmail.com> wrote in message
> news:e25bpkr6FHA.476@.TK2MSFTNGP15.phx.gbl...
> a
> only
>

Wednesday, March 7, 2012

copying data accross databases for backup

I am not an expert in SQL
I am faced with the task of copying certain attributes froma table in a
database to create a table in another database to have a sort of refined
backup database.I have to do it through a script to run in Sqlserver query
analyser I have created a query of sort ->
select attrib1, attrib2. into back_up_database_table From
Actual_database..Actual_table where <some condition>
I am logged to query analyser using the backup_database
I am promted to use the command sp_addlinkedserver for the actual database
however still i am getting the error SQLserver doesnot exist or access denie
d
How can I use an accross databes script
Can any help
Thanks in advance
AbhishekWhat kind of a DB are you copying from? Is it a SQL to SQL or access to SQL
?
"adg" wrote:

> I am not an expert in SQL
> I am faced with the task of copying certain attributes froma table in a
> database to create a table in another database to have a sort of refined
> backup database.I have to do it through a script to run in Sqlserver query
> analyser I have created a query of sort ->
> select attrib1, attrib2. into back_up_database_table From
> Actual_database..Actual_table where <some condition>
> I am logged to query analyser using the backup_database
> I am promted to use the command sp_addlinkedserver for the actual database
> however still i am getting the error SQLserver doesnot exist or access den
ied
> How can I use an accross databes script
> Can any help
> Thanks in advance
> Abhishek
>|||When selecting from a table on a linked SQL Server, keep in mind that the
server name prefix and object owner (typically DBO) are required. For
example, if you have a linked server called SERVERNAME:
select attrib1, attrib2. into back_up_database_table From
SERVERNAME.Actual_database.DBO.Actual_table where <some condition>
"adg" <u17748@.uwe> wrote in message news:5a7c9fe20d792@.uwe...
>I am not an expert in SQL
> I am faced with the task of copying certain attributes froma table in a
> database to create a table in another database to have a sort of refined
> backup database.I have to do it through a script to run in Sqlserver query
> analyser I have created a query of sort ->
> select attrib1, attrib2. into back_up_database_table From
> Actual_database..Actual_table where <some condition>
> I am logged to query analyser using the backup_database
> I am promted to use the command sp_addlinkedserver for the actual database
> however still i am getting the error SQLserver doesnot exist or access
> denied
> How can I use an accross databes script
> Can any help
> Thanks in advance
> Abhishek|||I was copying a sqlserver databases Thanks JT giving the fullname of the
database has solved the problem.Its working fine.
Thanks again
JT wrote:
>When selecting from a table on a linked SQL Server, keep in mind that the
>server name prefix and object owner (typically DBO) are required. For
>example, if you have a linked server called SERVERNAME:
>select attrib1, attrib2. into back_up_database_table From
>SERVERNAME.Actual_database.DBO.Actual_table where <some condition>
>
>[quoted text clipped - 13 lines]
Message posted via webservertalk.com
http://www.webservertalk.com/Uwe/Forum...amming/200601/1

Saturday, February 25, 2012

copyind data and indexes

Hi everyone!
How can I do to copy the data and the indexes from an existing table on a
database to a new table in another database?
I've tried with select * into base1.table1 from base2.table2, but it only
copy the data and not the indexes.
Can I do it by code? I'm trying to avoid the use of DTS.
Thanks.
Jaime LucciIn Query Analyzer you can auto-script the index for a table and apply
that to the newly created table
HTH,
Gerard|||How can I auto-script the index?
"Gerard" <g.doeswijk@.gmail.com> wrote in message
news:1132151890.279793.213110@.f14g2000cwb.googlegroups.com...
> In Query Analyzer you can auto-script the index for a table and apply
> that to the newly created table
> HTH,
> Gerard
>|||In Query Analyzer: Expand the Indexes folder on the table, select the
index you wish to script and right click on it and the rest will show
it self
NB:
You will have to replace the table name in the created script to apply
it to your other table