Getting Started with Adobe After Effects - Part 6: Motion Blur


Upload Image Close it
Select File

Welcome to my blog. I work as Database lead at Synaptic Digital. Hope you find some interesting stuff here.
Browse by Tags · View All
BRH 17
SQL Server 15
#SQL Server 11
#BI 10
#TSQL 8
TSQL 8
BI 7
SSRS 6
#SQLServer 6
SSRS 2008R2 5

Archive · View All
January 2011 6
December 2010 5
September 2012 4
May 2012 4
March 2011 4
November 2012 2
October 2012 2
January 2012 2
February 2011 2
November 2010 2

Bluk Insert – Comma as part of data

Dec 25 2010 10:38AM by Chintak Chhapia   

SQL Server MVP Madhivanan has shown us good trick of importing data with comma using OpenRowSet in this post.

After reading this post, I run given demo and I have done some experimenting with comma(,) as data in text based columns.

When I moved text based column to end, I am able to load the data successfully.

Let’s take an example,

Create  table

IF OBJECT_ID('dbo.BulkInsertTest','U') IS NOT NULL
	DROP TABLE dbo.BulkInsertTest
GO	
CREATE TABLE dbo.BulkInsertTest (Number INT,Name VARCHAR(100))
GO

Copy following lines as CSV, row three contains comma 

1,"Sachin Tendulker"
2,"Rahul Dravid"
4,"Graeme Smith"
3,"Kallis,Jacques"

Now, let’s execute following statement.

BULK INSERT dbo.BulkInsertTest 
	FROM 'C:\cri.csv' 
    WITH
     (
        FIELDTERMINATOR =',',
        ROWTERMINATOR = '\n'
      )

We are able to import data with comma into SQL server using bulk insert in case where comma containing column is at the end.

I think, the reason behind this is, even if we specify comma(,) as a FieldTerminator, in case of last column the FieldTerminator would be ‘\n’.
The same thing happens when we use SQL server Import-export wizard, column1(second column) has ColumnDelimitier as {CR}{LF}.


This can only be used when there is one text column in CSV, which can contain comma. If the text based column is not at end in table, we can use the Format file in bulk insert. This is just done for experimenting, I don’t see this  useful trick in most of real life scenarios.

Tags: SQL Server, #SQLServer, #TSQL, Bulk Insert, Comma,


Chintak Chhapia
40 · 5% · 1473
0
Liked
 
0
Lifesaver
 
0
Refreshed
 
0
Learned
 
0
Incorrect



Submit

Your Comment


Sign Up or Login to post a comment.

    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]