Showing posts with label named. Show all posts
Showing posts with label named. Show all posts

Tuesday, March 20, 2012

Copying named ranges or arrays from one sheet to another

Does anyone know how to achieve the following as my do loop contstructions
are taking quite a while to execute and this would be far faster I am sure
(i used to know how to do it but cannot for the life of me remember what I
did and I cannot find the answer on google)?
I have a column A containing dates which expand by one each day (funnily
enough). Basically I want to copy the dates from one sheet to another as
fast as possible) and then copy a column of numbers into the adjacent column
(I wnat to copy one column at a time so offset will probably do em when i
get the syntax). My idea is to define the column of dates as a named range
and then just say "the same range on shhet B is to equal the named range"
the idea being that just picking up the dates as a blocka nd plonking them
in the destination sheet is likeyl to be quicker than assigning the values
one at a time as i do now using a do loop construction.
Would appreciate any pointers, kind regards, MarkHi
When you talk of sheets I assume you are talking about excel and not SQL
Server? In which case there may be a more appropriate group to post to. If
you are using Excel as a linked server then it might be possible to somethin
g
like (untested):
INSERT INTO LinkedExcel..[Sheet2$](datecol1,col2,col3)
SELECT datecol1,col2,col3
FROM LinkedExcel..[Sheet1$]
WHERE datecol1 > '20050101'
AND datecol1 < '20050801'
John
"Mark Stephens" wrote:

> Does anyone know how to achieve the following as my do loop contstructions
> are taking quite a while to execute and this would be far faster I am sure
> (i used to know how to do it but cannot for the life of me remember what I
> did and I cannot find the answer on google)?
> I have a column A containing dates which expand by one each day (funnily
> enough). Basically I want to copy the dates from one sheet to another as
> fast as possible) and then copy a column of numbers into the adjacent colu
mn
> (I wnat to copy one column at a time so offset will probably do em when i
> get the syntax). My idea is to define the column of dates as a named range
> and then just say "the same range on shhet B is to equal the named range"
> the idea being that just picking up the dates as a blocka nd plonking them
> in the destination sheet is likeyl to be quicker than assigning the values
> one at a time as i do now using a do loop construction.
> Would appreciate any pointers, kind regards, Mark
>
>

Copying my SQL Database to another server

Hi guys,

I have created a new SQL database (named “DB”) on my personal pc at home.

I want to copy “DB” to my job’s computer, which works on a local net with SQL server.

What should I do?

Thanks a lot,

Aldo.

you need a connection between the machines first of. If you have VPN to your work's LAN you can use it or create a backup of the database or copy the database files in the sql server directories. If you take the offline/copy approach simply bring the file(s) via removable media into work and restore/attach the database file(s). If you can get a valid remote connection then you could use maintenance plans/SSIS to copy over the database between sql servers assuming you have valid login credentiuals to the remote "work" server.|||

Hi Derek, Which / where is the file I should copy in order to get an offline copy?

I've tried copying my ".mdf" file from this path: "C:\Program Files\Microsoft SQL Server\MSSQL.2\MSSQL\Data\DB.mdf" but getting something strange...

Thanks in advance,

Aldo.

|||sorry, you need to detach the database first and then reattach it.|||Where can I see how to "detach" and "reatach" a dababase?|||

Hi ajliks,

I would suggest , first you take a back up of your Database (Db) from your personal pc . Copy the back up file to a CD or some portable storage device. Copy it to your Job's computer. And the restore the database from there on to your SQL Server directly. This would be the easiest way to do it.

Thanks & Regards

Mathew

|||

Hi Mathew, thanks for anwering. I want to know how to make the SQL database copy. I've tried copying the mdf file but getting some strange stuff. (I want to copy the table and views configuration).

Thanks,

Aldo.

|||

1. Open your SQL Server Enterprise Manager

2. Expand and Point to your database.

3. Right Click on your database (Db), and navigate to "All Task " -- "Backup Database" -- "Add" -- "File Name"

4. Give a proper file name and note the location where the backup file is being created.

5. Copy This file to your Job Computer

6. For Restoring on your Job computer check the following steps

7. Open Enterprise Manager on your job computer.

8. Point to Database Node and Right Click on "Restore Database"

9 . Type your Database Name "Db" on the drop down box "Restore Database as"

10 Navigate through "From device" -- "Select devices" -- "Add" - "File Name"

11 Select the backup file and click ok.

You would get ur database created on your machine

Does this makes sense to you now

|||Thanks a lot man!

Sunday, March 11, 2012

Copying DB from one instance to another

Hi,

I want to copy the "Example" database of SQL 2000(default instance) into MSDE (named instance).

Both are installed on the same machine.

HOw to do this?

Thank You!

Use the copy database wizard. The SQL Server Tools General forum is probably the best place to ask about that http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=84&SiteID=1 and it is covered in Books Online http://msdn2.microsoft.com/en-us/library/ms188664.aspx

Donald Farmer

Thursday, March 8, 2012

Copying data from PRD to TST

I've got two DBs in the same SQL instance. They are named TST and PRD. I am using 2.0 so there are many ASP generated tables also.

Every once in a while I want to refresh data from PRD to TST. But I don't want to copy the data from ASP tables.

What is the easiest way to do so?

I moved your post from the FAQ fourm to here. Please note that the FAQ forum is for posting answers to commonly asked questions, not asking questions.

Ryan

|||I've always used SQL Server's built-in Data Transformation Services (DTS) to transfer data from one database to another. Be sure not to check the option to Create Destination Objects; choose only to Copy Data.|||Can you suggest a good resource for DTS? If I Google, there are so many hits that it is kinda hard to find a good one.|||Which version of SQL Server are you running? (Please be sure to put this information into any of your posts related to SQL Server.)|||Sorry about that. SQL Server 2005.|||Well, I haven't used SQL Server 2005 much; I currently only have SQL Express on my machine, and no Management Studio. However, I found this article which might help you get started:SQL Server 2005 Integration Services - Import and Export Wizard.

Friday, February 17, 2012

Copy Table

I have a DB which will have many tables that are the same only named
differently. Instead of recreating each one is there a way to "Copy Table" ?
Thanks in advanceIt is possible to "copy" a table via a SELECT statement
Lets say you have a table called foo and you want to copy it to a table =named bar.
This will copy the structure and data:
SELECT * INTO bar FROM foo
This will copy the structure:
SELECT * INTO bar FROM foo WHERE 0=3D1
Note: you have to have the select into/bulkcopy dboption set to 'on' for =this method to work.
-- Keith
"Jim Campau" <Jim_Campau@.bausch.com> wrote in message =news:uA1kPus1DHA.1760@.TK2MSFTNGP10.phx.gbl...
> I have a DB which will have many tables that are the same only named
> differently. Instead of recreating each one is there a way to "Copy =Table" ?
> > Thanks in advance
> >|||Hi,
Use the command
select * into newtablename from tablename
The above command copy the table along with data
select * into newtablename from tablename where 1=2
The above command copy the table structure only.
Thanks
Hari
MCDBA
"Jim Campau" <Jim_Campau@.bausch.com> wrote in message
news:uA1kPus1DHA.1760@.TK2MSFTNGP10.phx.gbl...
> I have a DB which will have many tables that are the same only named
> differently. Instead of recreating each one is there a way to "Copy Table"
?
> Thanks in advance
>