 |
|
 |
|
Next: trasversing through binary tree
|
| Author |
Message |
External

Since: Dec 10, 2008 Posts: 4
|
(Msg. 1) Posted: Thu Dec 18, 2008 6:48 am
Post subject: Help writing update query and timed execution Archived from groups: microsoft>public>sqlserver>mseq (more info?)
|
|
|
Part 1
I have table 1: dbo.OpportunityBase
I have table 2: dbo.CompanyPipeline - this is an exact copy of table 1
I want a query that updates table 2 with all the data in table 1,
overwriting everything in it (table 2).
Part 2
I'd like to be able to get this query to run automatically at a specific
time every day.
The reason for this is I need to show how the values in the table have
changed each day, therefore I will write a report querying the data from both
tables, hopefully giving me the difference between the two.
Anyone have any ideas on this?
Thanks in advance! >> Stay informed about: Help writing update query and timed execution |
|
| Back to top |
|
 |  |
External

Since: Dec 15, 2005 Posts: 14
|
(Msg. 2) Posted: Thu Dec 18, 2008 12:41 pm
Post subject: Re: Help writing update query and timed execution [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
"stacko111" wrote in message
> Part 1
> I have table 1: dbo.OpportunityBase
> I have table 2: dbo.CompanyPipeline - this is an exact copy of table 1
>
> I want a query that updates table 2 with all the data in table 1,
Well, first of all, if dbo.CompanyPipeline is an *exact copy* of
dbo.OpportunityBase, there's nothing to update!
So, shall we start over with practical premises?
> Part 2
> I'd like to be able to get this query to run automatically at a specific
> time every day.
That's what the SQL Agent is for.
--
Lawrence Garvin, M.S., MCITP(x2), MCTS(x5), MCP(x7), MCBMSP
Principal/CTO, Onsite Technology Solutions, Houston, Texas >> Stay informed about: Help writing update query and timed execution |
|
| Back to top |
|
 |  |
External

Since: Jan 31, 2006 Posts: 335
|
(Msg. 3) Posted: Thu Dec 18, 2008 7:25 pm
Post subject: Re: Help writing update query and timed execution [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
On Thu, 18 Dec 2008 06:48:02 -0800, stacko111 wrote:
>Part 1
>I have table 1: dbo.OpportunityBase
>I have table 2: dbo.CompanyPipeline - this is an exact copy of table 1
>
>I want a query that updates table 2 with all the data in table 1,
>overwriting everything in it (table 2).
Hi stacko111,
The easiest way is to use this sequence of two steps:
TRUNCATE TABLE dbo.CompanyPipeline;
INSERT INTO dbo.CompanyPipeline (Column1, Column2, ..., ColumnN)
SELECT Column1, Column2, ..., ColumnN
FROM dbo.OpportunityBase;
>Part 2
>I'd like to be able to get this query to run automatically at a specific
>time every day.
Create a SQL Agent job.
--
Hugo Kornelis, SQL Server MVP
My SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis >> Stay informed about: Help writing update query and timed execution |
|
| Back to top |
|
 |  |
External

Since: Dec 10, 2008 Posts: 4
|
(Msg. 4) Posted: Fri Dec 19, 2008 4:46 am
Post subject: Re: Help writing update query and timed execution [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Brilliant - works perfectly. Thanks!
"Hugo Kornelis" wrote:
> On Thu, 18 Dec 2008 06:48:02 -0800, stacko111 wrote:
>
> >Part 1
> >I have table 1: dbo.OpportunityBase
> >I have table 2: dbo.CompanyPipeline - this is an exact copy of table 1
> >
> >I want a query that updates table 2 with all the data in table 1,
> >overwriting everything in it (table 2).
>
> Hi stacko111,
>
> The easiest way is to use this sequence of two steps:
>
> TRUNCATE TABLE dbo.CompanyPipeline;
>
> INSERT INTO dbo.CompanyPipeline (Column1, Column2, ..., ColumnN)
> SELECT Column1, Column2, ..., ColumnN
> FROM dbo.OpportunityBase;
>
> >Part 2
> >I'd like to be able to get this query to run automatically at a specific
> >time every day.
>
> Create a SQL Agent job.
>
> --
> Hugo Kornelis, SQL Server MVP
> My SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
> >> Stay informed about: Help writing update query and timed execution |
|
| Back to top |
|
 |  |
| Related Topics: | Using Update...Set to update a table - I have a table (we'll call it table A) with two fields in it; one is an ID, and the other (named "State") currently only contains null values. I'd like to update the "State" field with values from another table in the database (tab...
Update 'Date': Set Day(Date) to a Certain Number - Hi, I am trying to use an update command to set the day of a date to a certain number. For example, if the date is 1/4/06, I might want to set day(date) to '7'. So it turns into 1/7/06. I wasn't sure if there was a way to do this and I keep getting....
query - Hi, I have some models that have hyhen in between. e.g.1200LD-VCD, abc-1234 May I know how to remove the hyhen. Thank you
query - hi i have some models that end with +SP e.g. 1234+SP, abcd+SP I want to remove only the +SP from these models. May i know how can i do it. Thank you
SQL Query - Hi all, i am not able to make up a query according to my need. can anyone help. Following is my simple query. select udf_name [Severity],st_name [Status], count(2) [count] from bugs, statuses, user_defined_attribute where udf_id =.. |
|
You can post new topics in this forum You can reply to topics in this forum You can edit your posts in this forum You can delete your posts in this forum You can vote in polls in this forum
|
|
|
|
 |
|
|