Where is my BLANKS

Last Post 29 Jul 2010 09:29 AM by Zoran, Jagodina. 6 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
Zoran, Jagodina
New Member
New Member

--
28 Jul 2010 08:36 AM
My file A.TXT created with NotePad ----------------------------------------------- 100140720102223470000103 200XXXX 000015000000010007000 200YY 000019000000010001600 200Z 000007000000010011200 3000000004100000 when do T-SQL -- Create a table to hold the data CREATE TABLE #textfile (line varchar(8000)) -- Read the text file into the temp table BULK INSERT #textfile FROM 'c:\A.TXT' GO -- Now read it SELECT * FROM #textfile -- And then clean up DROP TABLE #textfile GO I got target ------------------------------- 100140720102223470000103 200XXXX 000015000000010007000 200YY 000019000000010001600 200Z 000007000000010011200 3000000004100000 Why T-SQL kill blanks ?
Zoran, Jagodina
New Member
New Member

--
28 Jul 2010 08:37 AM
Once again
----------------------------------------------------
100140720102223470000103
200XXXX 000015000000010007000
200YY 000019000000010001600
200Z 000007000000010011200
3000000004100000



when do T-SQL
-- Create a table to hold the data
CREATE TABLE #textfile (line varchar(8000))
-- Read the text file into the temp table
BULK INSERT #textfile FROM 'c:\A.TXT'
GO
-- Now read it
SELECT * FROM #textfile
-- And then clean up
DROP TABLE #textfile
GO

I got target
-------------------------------
100140720102223470000103
200XXXX 000015000000010007000
200YY 000019000000010001600
200Z 000007000000010011200
3000000004100000

Why T-SQL kill blanks ?
Zoran, Jagodina
New Member
New Member

--
28 Jul 2010 08:39 AM
I can not make a question because editor kill blanks when I write question.
rm
New Member
New Member

--
28 Jul 2010 12:19 PM
What's sql version? Tried data type char(8000) instead of varchar(8000)?
Zoran, Jagodina
New Member
New Member

--
28 Jul 2010 10:54 PM
// What's sql version? Tried data type char(8000) instead of varchar(8000)?

Ver. SQL Server 2008 Express
There is no difference
rm
New Member
New Member

--
29 Jul 2010 03:38 AM
I don't have sql2k8 express, tried your code with same data in text file on sql2k8 and worked ok. You can double check with 'select CHARINDEX('1', line) from #textfile', I got 49 as result.
Zoran, Jagodina
New Member
New Member

--
29 Jul 2010 09:29 AM
me too, result is the same
You are not authorized to post a reply.

Acceptable Use Policy