Get empty data set for inserting data

  • I have 2 tables in my database.

    one is Race table and 2nd one is Age Range.

    I want to write a query where I can see all races and age range as column.

    TblRace

    ID, RaceName

    TblAgeRange

    ID,AgeRange.

    There is no connection between this two table. I need to display result like below.

    Race 17-20 21-30 31-40

    A

    B

    I

    W

    How do i get this kind of empty data set so that I can fill it out in front end or any better solution. The age range will be displayed as many row as they have. It's not static. Above is just an example.

    Thanks.

  • I would probably just write normal INSERT statements for this (wrap it in a stored procedure so you can pass data in and do whatever you want inside).

    What are you planning on doing with this? You could build a crosstab to do this either in T-SQL or in SSRS (easier in SSRS, I think, but then Jeff Moden would certainly disagree!). You might want to look up his article on Crosstabs in T-SQL.

Viewing 2 posts - 1 through 1 (of 1 total)

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