Showing posts with label everybody. Show all posts
Showing posts with label everybody. Show all posts

Sunday, March 11, 2012

Adding Query Results To A Tbale

hello everybody,

I have a small problem and was hipeing someone could help. Want to run a query, where I sellect results from two tables. Once this is done I want to takes those results and update a table that is already created with those results. How would I do this? Thw eonly way I know how to do this is by writing this:

select CompanyName, ContactName, Address, City, Region, ProductName, UnitPrice INTO TABLE2
From Suppliers, Products

But the problem with this is that I can only input the query results into a new table that I would name above. I can't insert it into a table that has already been created.

This is the erroe that I receive:
There is already an object named 'TABLE2' in the database.

Please Help!

thanksINSERT INTO TABLE2 (
CompanyName
, ContactName
, Address
, City
, Region
, ProductName
, UnitPrice)
SELECT
CompanyName
, ContactName
, Address
, City
, Region
, ProductName
, UnitPrice
From Suppliers, Products

I'd also say you're missing a JOIN|||So say that information changes on the 2 tables that I am querying, when I run this insert code with the query, it will reinsert all the records into table2, which will basically be updating it. Am i getting this right? Thats what I am trying to do. I could also turn that into a job so that it could run automatically right?

thanks|||Inserting will add records to the table unless you have constraints that prevent duplicate records/keys. Updating modifies the original field(s) of the record you are working with. Are you new to database design ?|||Can you elaborate what you are trying to do ?|||Originally posted by rnealejr
Inserting will add records to the table unless you have constraints that prevent duplicate records/keys. Updating modifies the original field(s) of the record you are working with. Are you new to database design ?

Actually yes, I am new to this. Thats probably why I sound redundante. So I need as much help as possibel

thanks|||Originally posted by rnealejr
Can you elaborate what you are trying to do ?

Okay, here it goes. I created a table called "table1". This table has all the columns named already. I want to hold records from a a query that I run on two other tables and then place the results in table2. The colums that I query are named the same as the columns I created in table2. I just want all those records to show up in table2.|||Aren't you planning on using the code I posted?|||Originally posted by Brett Kaiser
Aren't you planning on using the code I posted?
ACTUALLY i USED IT AND IT WORKED WELL. i WAS JUST WONDERING IF THERE WERE OTHER WAYS OF DOING IT.
THANKS FOR YOUR HELP. i AM PRETTY NEW AT THIS.

Saturday, February 25, 2012

Adding Integration Services to the existing Sqlserver 2005 - Question

Hello to everybody,

Installed the Integration Services to the existing Sqlserver 2005. But I am not seeing the 'Integration Services' in the

SQL Server Management Studio, like the 'SQL Server Agent' in the server. I am not sure what the next step is after installing the 'Integration Services'. Appreciate any help on this. Thanks for your time in advance.

Thanks,
Gopal.

It's a different server type, like Analysis Services. When you start a new connection, choose Integration Services instead of Database Engine.

|||

Also please notice that you should be doing most SSIS work in BIDS (Business Intelligence Dev Studio), not in SSMS. I recommend starting with Books Online or the Guided Tour: http://www.microsoft.com/sql/technologies/integration/tours.mspx, in particular Visual Development Environment Guided Tour.

Friday, February 24, 2012

Adding Field

Hi everybody,
How can i add a field in a table which is involved in a Transactional
replication.
Thanks,
MAtthew
Which version of SQL Server are you running on? If you are running on SQL
Server 2000, then you could use sp_repladdcolumn for this.
SQL Server 2005 has much better support for this, as it can replicate DDL.
HTH,
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
"Mathew" <Mathew@.discussions.microsoft.com> wrote in message
news:49D55E36-A705-4898-B063-7996DE3F7C7D@.microsoft.com...
Hi everybody,
How can i add a field in a table which is involved in a Transactional
replication.
Thanks,
MAtthew