database denormalization

  • Hi I would like to denormalize this database attached,

    I have to denormalize for these reads

    select @NoOfDrivers= drivers.DriverID,@DriverName =

    upper(left(DriverFname,1))+ RIGHT(driverfname, len(driverfname)-1)+' '

    + upper(left(DriverLname,1))+ RIGHT(driverLname, len(driverLname)-1)

    from dbo.Drivers

    inner join VehicleTeams on

    Drivers.DriverID= VehicleTeams.DriverID

    inner join loads on

    VehicleTeams.VehicleTeamID=Loads.VehicleTeamID

    inner join Vehicles on

    VehicleTeams.VehicleID=Vehicles.VehicleID

    where ASCII(Class)<= ASCII(driverlicence)

    and Loads.LoadID=@LoadID

    should I put the driverid,drivernames,driver licence into the load_tbl? slightly confused

  • so am i.

    a little more detail on what you are trying to accomplish will be very helpful here.


    For faster help in answering any problems Please read How to post data/code on a forum to get the best help - Jeff Moden[/url] for the best way to ask your question.

    For performance Issues see how we like them posted here: How to Post Performance Problems - Gail Shaw[/url]

    Need to Split some strings? Jeff Moden's DelimitedSplit8K[/url]
    Jeff Moden's Cross tab and Pivots Part 1[/url]
    Jeff Moden's Cross tab and Pivots Part 2[/url]

  • In the read i need to select the driver name and a driver that is qualified to drive a certain vehicle, the input is the load_id from the load table, but i need to denormalize it so i will have less joins?

  • finnyol (11/26/2012)


    In the read i need to select the driver name and a driver that is qualified to drive a certain vehicle, the input is the load_id from the load table, but i need to denormalize it so i will have less joins?

    What is wrong with joins? Why do you think denormalizing this will help?

    The more I read your query the more I get the feeling that you aren't sure how to accomplish whatever it is you are trying to do. You have a query that at least as far as the ddl is concerned can return multiple rows but you are using that query to assign values to variables.

    _______________________________________________________________

    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/

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply