<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Oracle Tips and Techniques &#187; SQL Server BCP Utility</title>
	<atom:link href="http://www.oraclecity.com/category/bcp-utility/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.oraclecity.com</link>
	<description>Oracle 11g, Oracle 10g, PL/SQL, Oracle Enterprise Manager 11g Grid Control, Oracle Performance Tuning, Microsoft SQL Server and T-SQL</description>
	<lastBuildDate>Thu, 12 Jan 2012 11:36:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>BCP Utility – using BCP IN in Microsoft SQL Server</title>
		<link>http://www.oraclecity.com/bcp-utility/bcp-utility-using-bcp-out-in-microsoft-sql-server/</link>
		<comments>http://www.oraclecity.com/bcp-utility/bcp-utility-using-bcp-out-in-microsoft-sql-server/#comments</comments>
		<pubDate>Fri, 23 Oct 2009 12:02:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[SQL Server BCP Utility]]></category>
		<category><![CDATA[bcp_utility]]></category>
		<category><![CDATA[Microsoft SQL Server]]></category>
		<category><![CDATA[oracle]]></category>

		<guid isPermaLink="false">http://www.oraclecity.com/?p=101</guid>
		<description><![CDATA[In this posting I will show you (BCP IN) how easily you can transfer your data from your operating system file to Microsoft SQL Server database.]]></description>
			<content:encoded><![CDATA[<p align="left">In this posting I will show you (BCP IN) how easily you can transfer your  data from your operating system file to Microsoft SQL Server database. If you have not  read my posting on BCP OUT then click here  <a title="Permanent Link to BCP Utility –  using BCP OUT in Microsoft SQL Server" rel="bookmark" href="../bcp-utility-bcp-out-microsoft-sql-server/">BCP  Utility – using BCP OUT in Microsoft SQL Server</a> to read it.</p>
<p>The Syntax diagram for the BCP command is shown below:</p>
<p><span id="more-101"></span>C:\&gt;<em><strong>bcp</strong></em><br />
usage: bcp {dbtable | query} {in | out | queryout | format} datafile<br />
[-m maxerrors] [-f formatfile] [-e errfile]<br />
[-F firstrow] [-L lastrow] [-b batchsize]<br />
[-n native type] [-c character type] [-w wide character type]<br />
[-N keep non-text native] [-V file format version] [-q quoted identifier]<br />
[-C code page specifier] [-t field terminator] [-r row terminator]<br />
[-i inputfile] [-o outfile] [-a packetsize]<br />
[-S server name] [-U username] [-P password]<br />
[-T trusted connection] [-v version] [-R regional enable]<br />
[-k keep null values] [-E keep identity values]<br />
[-h "load hints"]</p>
<p>I am not going to write same things again that I wrote for BCP OUT post (regarding  where to find bcp.exe etc). Instead lets go straight into the example.</p>
<p>In the example below I will show you how to take data out from your database table to  an operation system file.</p>
<p><span style="text-decoration: underline;"><strong>Example l. Import data from an  operating system file into the database.</strong></span></p>
<p>This example assumes that you have the login details of the database.  The  operating system file that has the data data file name is</p>
<p>Step 1.: Open a DOS prompt and go to C:\ prompt</p>
<p>Step 2. type <em><strong>bcp mydev_db..tbl_params in c:\tbl_params_data1.txt -c -t , -r  \n -Usa -Pmypassword</strong></em></p>
<p>and then hit Enter key. You should get the following output on your DOS window:</p>
<p>Starting copy&#8230;</p>
<p>177 rows copied.<br />
Network packet size (bytes): 4096<br />
Clock Time (ms.): total 1Step</p>
<p>3. Inport is now complete. Your data from your text file is now in your database table  tbl_params.</p>
<p>Meaning of the parameters supplied in the command:</p>
<p>-c : instructs BCP to perform the bulk copy operation using “character” data type.</p>
<p>-t , : is the filed terminator. Each column will be terminated by “,” which you can  look at your output file.</p>
<p>-r \n : is the row terminator. This simply means that put each row of records in a new  line.</p>
<p>-U :is the SQL Server user</p>
<p>-P :is the password</p>
]]></content:encoded>
			<wfw:commentRss>http://www.oraclecity.com/bcp-utility/bcp-utility-using-bcp-out-in-microsoft-sql-server/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>BCP Utility &#8211;  using BCP OUT in Microsoft SQL Server</title>
		<link>http://www.oraclecity.com/bcp-utility/bcp-utility-bcp-out-microsoft-sql-server/</link>
		<comments>http://www.oraclecity.com/bcp-utility/bcp-utility-bcp-out-microsoft-sql-server/#comments</comments>
		<pubDate>Fri, 09 Oct 2009 09:15:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[SQL Server BCP Utility]]></category>
		<category><![CDATA[bcp_in]]></category>
		<category><![CDATA[bcp_out]]></category>
		<category><![CDATA[bcp_utility]]></category>

		<guid isPermaLink="false">http://www.oraclecity.com/?p=86</guid>
		<description><![CDATA[This article will show you (with example) how to use BCP OUT in Microsoft SQL Server. ]]></description>
			<content:encoded><![CDATA[<p align="left">BCP is a tool developed by Microsoft which can be easily used to migrate data from one database to another or to copy data from the SQL Server database to a operating system file or vice versa. This is a very powerful tool that I found very useful while working on my development work using SQL Server databases. To export data using BCP you your BCP OUT and to import data you will use BCP IN. In this posting I will show you (BCP OUT) how easily you can transfer your data from your Microsoft SQL Server database to an operating system file.</p>
<p>To find out whether you have bcp utility properly installed/configured in your machine (of course with SQL Server database) just open a DOS prompt and type bcp abd hit ENTER key as shown below:</p>
<p>C:\&gt;<em><strong>bcp</strong></em><br />
usage: bcp {dbtable | query} {in | out | queryout | format} datafile<br />
[-m maxerrors] [-f formatfile] [-e errfile]<br />
[-F firstrow] [-L lastrow] [-b batchsize]<br />
[-n native type] [-c character type] [-w wide character type]<br />
[-N keep non-text native] [-V file format version] [-q quoted identifier]<br />
[-C code page specifier] [-t field terminator] [-r row terminator]<br />
[-i inputfile] [-o outfile] [-a packetsize]<br />
[-S server name] [-U username] [-P password]<br />
[-T trusted connection] [-v version] [-R regional enable]<br />
[-k keep null values] [-E keep identity values]<br />
[-h "load hints"]</p>
<p><span id="more-86"></span></p>
<p>If you have bcp then you should output something like above. If you don&#8217;t see the output, then go to your windows explorer and navigate to the &#8220;Binn&#8221; sub directory of your installation directory. In my machine it is in C:\Program Files\Microsoft SQL Server\80\Tools\Binn. In Binn sub directory you should see and executable called bcp.exe &#8211; this is the bcp tool that I am going to use to export data to an operating system file. If you have bcp.exe file in a similar directory just add the full path to your environment &#8220;path&#8221; variable. Otherwise you can run by specifying the full path like C:\&gt;<em><strong>&#8220;C:\Program Files\Microsoft SQL Server\80\Tools\Binn&#8221;\bcp.exe</strong></em></p>
<p>It looks quite scary to see so many options available and not knowing what to do with them, at least I felt that way when I first saw it. But it is not that difficult and quite easy depending on what you want to do with it.</p>
<p>In the example below I will show you how to take data out from your database table to an operation system file.</p>
<p><span style="text-decoration: underline;"><strong>Example l. Export all data from a table to a file.</strong></span></p>
<p>This example assumes that you have the login details of the database.</p>
<p>Step 2. Open a DOS prompt and go to C:\ prompt</p>
<p>Step 2: type <em><strong>bcp mydev_db..tbl_params out c:\tbl_params_data1.txt -c -t , -r \n -Usa -Pmypassword</strong></em></p>
<p>and then hit Enter key. Depending on the size of the table and data it might take some time to get your prompt back. You should get the following output on your DOS window:</p>
<p>Starting copy&#8230;</p>
<p>177 rows copied.<br />
Network packet size (bytes): 4096<br />
Clock Time (ms.): total 15</p>
<p>Step 3. Done. Data from your database table tbl_params is now in your named file tbl_params_data1.txt in your C:\ drive.</p>
<p>Let discuss the parameters that I supplied:</p>
<p>-c : instructs BCP to perform the bulk copy operation using &#8220;character&#8221; data type.</p>
<p>-t , : is the filed terminator. Each column will be terminated by &#8220;,&#8221; which you can look at your output file.</p>
<p>-r \n : is the row terminator. This simply means that put each row of records in a new line.</p>
<p>-U :is the SQL Server user</p>
<p>-P :is the password</p>
<p><span style="text-decoration: underline;"><strong>Example 2. Export selected data from a table to a file.</strong></span></p>
<p>This example assumes that you have the login details of the database.</p>
<p>Step 1. Open a DOS prompt and go to C:\ prompt</p>
<p>Step 2: type <em><strong>bcp &#8220;select * from mydev_db..tbl_params where code like &#8216;US%&#8217;&#8221; queryout c:\tbl_params_data1.txt -c -t , -r \n -Usa -Pmypassword </strong></em></p>
<p>and then hit Enter key. You should get the following output on your DOS window:</p>
<p>Starting copy&#8230;</p>
<p>15 rows copied.<br />
Network packet size (bytes): 4096<br />
Clock Time (ms.): total 1</p>
<p>Step 3. Done. Selected data based on your query from your database table is now in your named file t_emp_data2.txt in your C:\ drive.</p>
<p>The meaning of the parameters supplied to the command is explained in example 2 above.</p>
<p>So this demonstrates how easy it is to export (BCP OUT) data from your SQL Server table to a flat file.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.oraclecity.com/bcp-utility/bcp-utility-bcp-out-microsoft-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

