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

Update Nulls With Value from Another Row

$
0
0

Good Morning,

I word for a car manufacturer. I am pulling an excel spreadsheet into SQL 2012.The spreadsheet lists one line for each dealer, each carline. So if there are 6 carlines and 65 dealers there will be 390 lines. when the spreadsheet gets to me it looks like this:

Dealer           Carline         District         Data         Data         Data

East Side CraworldModel110 0

Model2 100

Model310 00

So the Dealer is only listed once. When I pull this into SQL the blank lines are nulls and I want them to be the Dealer name in there. How can I accomplish this with an update.

Just one thing more. When I programmed in access, I would loop through a table and set a variaiable =Dealer name and not change the variable until the next not null row and then make that the new variable all the while making nulls=the variable. Is there a way to accomplish that here.


Viewing all articles
Browse latest Browse all 23857

Trending Articles



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