• realvilla (6/19/2013)


    OK, I am set up now with rights on the database which is 2008. I run the following code and get 0 records. Notice the "select COUNT(*) from VehiclesToUpdate" line. I noticed that the table (I went ahead and took out the spaces in the file name thinking it would correct what I am about to tell you) has a RED UNDERLINE under the table name whether or not I place a "dbo" in front of it. The fields names have red underlines as well. This is probably something very simple, but I am not as familiar with 2008. I placed underlines under the new stuff I added. Anyway, here is the code:

    The red underlines are most likely just because intellisense is not up to date. When you rename, create or drop objects intellisense is not updated. Just hit ctrl + shift + r and it will update.

    As far as no rows being returned, it is impossible for me to determine because I don't have the same data you do. Change your join to a left join. If that now returns rows but the other side is NULL then there is something in your join not right. About the best I can do remotely is get you close. You will have to do the last little bit of tweaking and debugging from where you have access.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/