﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2005 / SQL Server Express  / Help me for insert on query please / Latest Posts</title><generator>InstantForum.NET v4.1.4</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Tue, 24 Nov 2009 14:41:07 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Help me for insert on query please</title><link>http://www.sqlservercentral.com/Forums/Topic744959-324-1.aspx</link><description>Sorry Friend ,                    In my last post i think i have given you the steps for inserting data from any file into any table .                 But now i realise that that is worthless for you . Now for your post how can i insert more that one row with query so Now use this simple query .               Insert into table [Table Name]               Select [Col1,Col2,Col3,Col4....etc] from [Table Name]Use This Query</description><pubDate>Fri, 03 Jul 2009 05:42:57 GMT</pubDate><dc:creator>Vinit Srivastava</dc:creator></item><item><title>RE: Help me for insert on query please</title><link>http://www.sqlservercentral.com/Forums/Topic744959-324-1.aspx</link><description>Okay, my post above looks strange to me.</description><pubDate>Tue, 30 Jun 2009 23:13:36 GMT</pubDate><dc:creator>Lynn Pettis</dc:creator></item><item><title>RE: Help me for insert on query please</title><link>http://www.sqlservercentral.com/Forums/Topic744959-324-1.aspx</link><description>Sample code for you to play with.  You will need to put the data into a text file, and be sure to modify the line where I have the code looking for the file to point to where you put it.[code]/*Sample data from file CustInfo.txt:1,"John","Smith","Washington"2,"Nick","Smith","London"3,"blabla","blabla","blaa"*/create table dbo.TestTable (    MemberID int,    FirstName varchar(30),    LastName varchar(30),    City varchar(30));bulk insert dbo.TestTablefrom 'C:\Databases\ImportData\CustInfo.txt'with (    codepage = 'RAW',    datafiletype = 'char',    fieldterminator = ',',    rowterminator = '');update dbo.TestTable set    FirstName = replace(FirstName,'"',''),    LastName = replace(LastName,'"',''),    City = replace(City,'"','');select    *from    dbo.TestTable;drop table dbo.TestTable;[/code]</description><pubDate>Tue, 30 Jun 2009 23:11:54 GMT</pubDate><dc:creator>Lynn Pettis</dc:creator></item><item><title>RE: Help me for insert on query please</title><link>http://www.sqlservercentral.com/Forums/Topic744959-324-1.aspx</link><description>Hi Friend ,              Fallow below steps .              1. Create one function with three parameter                  String( RowData),Delimeter,Position that return the data for the passed position from the passed rowdata.              Create Function [Functin Name]              (                 @Rowdata VARCHAR(8000),	         @Delimeter CHAR(1),	         @Position INT               )              RETURNS 	VARCHAR(300)             AS             BEGIN                     --Write here code for find the data from the passed Rowdata             END              2. Use bulk insert command and store the data in a #Temp table( Having only one column with size varchar(4000) .              3. After completing above steps in one select statement all the data from the text file will be inserted in your table . For Ex.                Insert into [Table Name]               Select Function(Rowdata,delimeter,position) from #TempTableThanksVinit Srivastava</description><pubDate>Tue, 30 Jun 2009 22:56:01 GMT</pubDate><dc:creator>Vinit Srivastava</dc:creator></item><item><title>RE: Help me for insert on query please</title><link>http://www.sqlservercentral.com/Forums/Topic744959-324-1.aspx</link><description>[quote][b]Nardig (6/30/2009)[/b][hr]Yes the text file looks like this1,'John','Smith','Washington'2,'Nick','Smith','London'3,'blabla','blabla','blaa'...this text contains 1200 records[/quote]Check out Books-Online (BOL) for "BULK INSERT". If your destination table has additional columns, you may need a format file (see "BCP" in BOL for how to create one). Since your field terminator isn't a tab, you'll need to specify that in the BULK INSERT command.</description><pubDate>Tue, 30 Jun 2009 21:43:16 GMT</pubDate><dc:creator>WayneS</dc:creator></item><item><title>RE: Help me for insert on query please</title><link>http://www.sqlservercentral.com/Forums/Topic744959-324-1.aspx</link><description>Yes the text file looks like this1,'John','Smith','Washington'2,'Nick','Smith','London'3,'blabla','blabla','blaa'...this text contains 1200 records</description><pubDate>Tue, 30 Jun 2009 17:25:22 GMT</pubDate><dc:creator>Nardig</dc:creator></item><item><title>RE: Help me for insert on query please</title><link>http://www.sqlservercentral.com/Forums/Topic744959-324-1.aspx</link><description>[quote][b]Nardig (6/30/2009)[/b][hr]ok i have one table with MemberID, Name, Surname and City and information for inserted on this table and i have on text file for example 1001, John, Smith, Washington another member is 1002, Nick, Dagle, London etc etc. I request to insert at the same time on this table.for exampleINSERT INTO TblMember                      (MemberID, Name, Surname, City)VALUES     (1001,John,Smith,Washington;                 1002, Nick, Smith, London                  1003,....,.....,.....) I hope you know what I think nowthanks[/quote]You want to import a text file into a table?  Each row of the text file contains a record with MemberId, FirstName,  LastName, City?What is the delimiter between columns? Rows? Are the string values delimited and if so with what, double quotes?</description><pubDate>Tue, 30 Jun 2009 16:51:48 GMT</pubDate><dc:creator>Lynn Pettis</dc:creator></item><item><title>RE: Help me for insert on query please</title><link>http://www.sqlservercentral.com/Forums/Topic744959-324-1.aspx</link><description>ok i have one table with MemberID, Name, Surname and City and information for inserted on this table and i have on text file for example 1001, John, Smith, Washington another member is 1002, Nick, Dagle, London etc etc. I request to insert at the same time on this table.for exampleINSERT INTO TblMember                      (MemberID, Name, Surname, City)VALUES     (1001,John,Smith,Washington;                 1002, Nick, Smith, London                  1003,....,.....,.....) I hope you know what I think nowthanks</description><pubDate>Tue, 30 Jun 2009 16:41:15 GMT</pubDate><dc:creator>Nardig</dc:creator></item><item><title>RE: Help me for insert on query please</title><link>http://www.sqlservercentral.com/Forums/Topic744959-324-1.aspx</link><description>I have no idea.  You haven't provided us with anything to work with here.</description><pubDate>Tue, 30 Jun 2009 16:13:22 GMT</pubDate><dc:creator>Lynn Pettis</dc:creator></item><item><title>Help me for insert on query please</title><link>http://www.sqlservercentral.com/Forums/Topic744959-324-1.aspx</link><description>how can i insert more that one row with query on a singel table</description><pubDate>Tue, 30 Jun 2009 16:05:36 GMT</pubDate><dc:creator>Nardig</dc:creator></item></channel></rss>