sql server - Convert excel data into SQL table -


I have an Excel, which has a few columns (column 1, column 2, column 3, .... so on ) And the rows, the number of columns and rows is not fixed here.

Now the data of this Excel has been copied into one table ( Type-Navbar (Max) ) ... Now I have to take data from this column and SQL Need to show in table format in

If the number of columns is fixed, then I can easily convert column values ​​into XML values ​​and show the data in a tabular format. As the number of columns is not fixed, please get the desired output, please suggest.

Believe me, you use ',' as the delimiter .
2. You do not worry about performance after putting everything in a column

Will the following help come? Create table (Col. '1,2') *** / DECLARE @ MXX as int, integer @ I as SELECT @ maxcol = max (lan (change, ',', ''))) + 1 Select TBL @ i = 1 (maximum) declared as @nvarsql nvarchar @nvarsql = '' while @ I & lt; Start = @ maxcol @nvarsql set = @nvarsql + 'IsNull (DBO.fnString_DelimeterIndex (col,' ',' ',' + varchar in the form of +i '),' 'as' 'COL' + CAST (@ AS VARCHAR) + ',' Set @ eye = @e +1 end if @newscle>> set @nvarsql = 'SELECT' + left (@nvarsql, LEN (nvarsql) -1) + 'FROM Tbl' end print @NervicesAxic (@newarskill)

Scalar Function Downloads from anywhere function changes [dbo]. [ fnString_DelimeterIndex] (@Text NVARCHAR (4000), @Delimiter CHAR, @Section SMALLINT) declared back as NVARCHAR (4000) @NextPos SMALLINT, @LastPos SMALLINT, @Found SMALLINT start, @Rosh Please select @ rect = 1 @ @extPos = CHARINDEX (@Delimiter, @Text, 1), @LastPos = 0 if the @ bit> @txt = reverse (@Text) -, @ section = 1, select @btpos = 0 , @Found = 1 @NextPos & gt; 0 and ABS (@chen)>

Results from the sample above < pre> COL1 COL2 COL3 COL4 1 2 3 4 1 2 3 1 2

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -