Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want upload only .csv formate files in my web page and as soon as i click on Update button it will automatically create table with columns
here
file name= table name and
first row of the file (headings)= columns of the table

how to write the code for it in MS SQL server.
Posted
Comments
Kiran Susarla 28-Sep-12 5:28am    
I am assuming you want to write code using ADO.Net? Can you please share what have you tried till now?

1 solution

U should try like this :

SQL
ALTER PROCEDURE spName(
DECLARE @tableName VARCHAR(100),@columnName VARCHAR(50),@Query VARCHAR(8000) )
BEGIN 
SET @Query='CREATE TABLE '  + @tableName + '(' +@columnName + ' VARCHAR(200)'+ ')'
EXECUTE (@Query)
END 


// U should pass table name and column name from front end

I hope this will help u
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900