Click here to Skip to main content
13,143,774 members (30,221 online)
Rate this:
Please Sign up or sign in to vote.
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
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 27-Sep-12 23:04pm
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

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

U should try like this :

DECLARE @tableName VARCHAR(100),@columnName VARCHAR(50),@Query VARCHAR(8000) )
SET @Query='CREATE TABLE '  + @tableName + '(' +@columnName + ' VARCHAR(200)'+ ')'
EXECUTE (@Query)

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

I hope this will help u

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.170915.1 | Last Updated 29 Sep 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100