Skip to main content
appended answer 52054 as supplemental
Source Link
Jack Douglas
  • 40.2k
  • 15
  • 104
  • 177

I am new to this field if you can please tell me if it is possible to do this it will be very help full. I have SQL Server 2008 R2.

What I want to do is from my table I want to take first row and try to use it as a column name to create another table in a stored procedure. The reason why I want to use those particular column name is which will come in as data in first row is, it will keep changing every week since those are dates.

So my plan is if it is possible to extract that first line from data which is ([Employee Name], [10/18/2013], [10/19/2013]..) and create another table which will use that extracted data as "column name" and create another SP will fill data as required. But I have no clue if SQL will create table and use "column name" which extracted from another data.


Further information in response to the answer:

What I am trying to do is. I have data coming in as time sheet every week. my plan is once I will get time sheet in every week as excel I will some how import into SQL as Import/export. the only problem is that Time Sheet have columns start from [Last Name], [First Name], [10/21/2013],[10/22/2013],[10/23/2013],...,[10/24/2013]. and I need those date columns in my data so I can use those in my later store procedure. in order for it do, I have included those columns in my data and not in headers when I import, so I can use those data. after doing that i have wrote one simple store procedures, which only read first row which will be first name, last name, 10/21/2013, 10/22/2013 and so on to extract header from the data. and from their i want to execute a store procedure to create new table every week(since date will be change every week) and will have first name, last name, 10/21/2013, hours of work, Taxonomy( will have 3 characters from fist name, last name, date and proj name) in different table. once the time push for that week at the end i will delete that table.

I apologize if that sounds confusing. Do you think I am going on right direction. if you know any links that explain this type of case, it will be so helpful since i am new to this field.

I am new to this field if you can please tell me if it is possible to do this it will be very help full. I have SQL Server 2008 R2.

What I want to do is from my table I want to take first row and try to use it as a column name to create another table in a stored procedure. The reason why I want to use those particular column name is which will come in as data in first row is, it will keep changing every week since those are dates.

So my plan is if it is possible to extract that first line from data which is ([Employee Name], [10/18/2013], [10/19/2013]..) and create another table which will use that extracted data as "column name" and create another SP will fill data as required. But I have no clue if SQL will create table and use "column name" which extracted from another data.

I am new to this field if you can please tell me if it is possible to do this it will be very help full. I have SQL Server 2008 R2.

What I want to do is from my table I want to take first row and try to use it as a column name to create another table in a stored procedure. The reason why I want to use those particular column name is which will come in as data in first row is, it will keep changing every week since those are dates.

So my plan is if it is possible to extract that first line from data which is ([Employee Name], [10/18/2013], [10/19/2013]..) and create another table which will use that extracted data as "column name" and create another SP will fill data as required. But I have no clue if SQL will create table and use "column name" which extracted from another data.


Further information in response to the answer:

What I am trying to do is. I have data coming in as time sheet every week. my plan is once I will get time sheet in every week as excel I will some how import into SQL as Import/export. the only problem is that Time Sheet have columns start from [Last Name], [First Name], [10/21/2013],[10/22/2013],[10/23/2013],...,[10/24/2013]. and I need those date columns in my data so I can use those in my later store procedure. in order for it do, I have included those columns in my data and not in headers when I import, so I can use those data. after doing that i have wrote one simple store procedures, which only read first row which will be first name, last name, 10/21/2013, 10/22/2013 and so on to extract header from the data. and from their i want to execute a store procedure to create new table every week(since date will be change every week) and will have first name, last name, 10/21/2013, hours of work, Taxonomy( will have 3 characters from fist name, last name, date and proj name) in different table. once the time push for that week at the end i will delete that table.

I apologize if that sounds confusing. Do you think I am going on right direction. if you know any links that explain this type of case, it will be so helpful since i am new to this field.

added 30 characters in body; edited title
Source Link
marc_s
  • 9k
  • 6
  • 45
  • 52

create Create table from stored procedure result

iI am new to this field if you can please tell me if it is possible to do this it will be very help full. I have sqlSQL Server 2008 r2R2. what i

What I want to do is from my table iI want to take first row and try to use it as a column name to create another table by SPin a stored procedure. theThe reason why iI want to use those particular column name is which will come in as data in first row is, it will keep changing every week since those are dates. so

So my plan is if it is possible to extract that first line from data which is ( [Employee[Employee Name], [10/18/2013], [10/19/2013]..) and create another table which will use that extracted data as "column name" and create another SP will fill data as required. but iBut I have no clue if SQL will create table and use "column name" which extracted from another data.

create table from stored procedure result

i am new to this field if you can please tell me if it is possible to do this it will be very help full. I have sql 2008 r2. what i want to do is from my table i want to take first row and try to use it as a column name to create another table by SP. the reason why i want to use those particular column name is which will come in as data in first row is, it will keep changing every week since those are dates. so my plan is if it is possible to extract that first line from data which is ( [Employee Name], [10/18/2013], [10/19/2013]..) and create another table which will use that extracted data as "column name" and create another SP will fill data as required. but i have no clue if SQL will create table and use "column name" which extracted from another data.

Create table from stored procedure result

I am new to this field if you can please tell me if it is possible to do this it will be very help full. I have SQL Server 2008 R2.

What I want to do is from my table I want to take first row and try to use it as a column name to create another table in a stored procedure. The reason why I want to use those particular column name is which will come in as data in first row is, it will keep changing every week since those are dates.

So my plan is if it is possible to extract that first line from data which is ([Employee Name], [10/18/2013], [10/19/2013]..) and create another table which will use that extracted data as "column name" and create another SP will fill data as required. But I have no clue if SQL will create table and use "column name" which extracted from another data.

Source Link

create table from stored procedure result

i am new to this field if you can please tell me if it is possible to do this it will be very help full. I have sql 2008 r2. what i want to do is from my table i want to take first row and try to use it as a column name to create another table by SP. the reason why i want to use those particular column name is which will come in as data in first row is, it will keep changing every week since those are dates. so my plan is if it is possible to extract that first line from data which is ( [Employee Name], [10/18/2013], [10/19/2013]..) and create another table which will use that extracted data as "column name" and create another SP will fill data as required. but i have no clue if SQL will create table and use "column name" which extracted from another data.