Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Inserting Data into a Table based upon a View

$
0
0

Hi All,

OK, I've got an interesting little task and I cannot work how to do it and I am hoping that someone kind enough will help me.

So here goes:

I have a view called "vwSalesAccSurchSet" within the "Sales" Database and this returns all Sales Accounts which have a surcharge set of "New Set 2013" along with the AccountID and UserID.


We have a table called "Surcharges" within the "Web" database and this holds all the individual Surcharges.

What I am after is this:

As soon as an Account is assign to the "New Set 2013" surcharge set a number of fixed predefined surcharges are inserted into the "Surcharges" table carrying the "UserID" from the vwSalesAccSurchSet into "dwUserIdfk". 

Now obviously there needs to be a check in place so that it doesn't insert duplicate rows.

I hope this all makes sense.

Thanks guys!!


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>