Showing posts with label sample. Show all posts
Showing posts with label sample. Show all posts

Tuesday, March 20, 2012

Quickest method of updating a Table

I have a DataSet which I am holding in .NET and I would like to know the quickest way to get the DataSet in to a Table on SQL Server?

Any sample code would be great.

How many tables you have in dataset?

Fastest and easiest way to do it is probably using Data Adapter.

Thanks

|||Only one table, with over 1,000,000 records|||

And How you generate this data in your DataSet it is loaded from somewhere?

Fastest way will be to save it to file and next import to SQL using SSIS package or bulk copy command.

You can also try DataAdapter but

Thanks

it|||

And How you generate this data in your DataSet it is loaded from somewhere?

Fastest way will be to save it to file and next import to SQL using SSIS package or bulk copy command.

You can also try DataAdapter but

Thanks

it is|||

And How you generate this data in your DataSet it is loaded from somewhere?

Fastest way will be to save it to file and next import to SQL using SSIS package or bulk copy command.

You can also try DataAdapter but it

Thanks

|||

Hi CopperMill,

I agree that you can use SSIS to import data. You can also use bcp utility to perform fast bulk copy.

The bcp utility bulk copies data between an instance of Microsoft SQL Server 2005 and a data file in a user-specified format. The bcp utility can be used to import large numbers of new rows into SQL Server tables or to export data out of tables into data files. Except when used with the queryout option, the utility requires no knowledge of Transact-SQL. To import data into a table, you must either use a format file created for that table or understand the structure of the table and the types of data that are valid for its columns.


For more information, please check

http://msdn2.microsoft.com/en-us/library/ms162802.aspx

If the data you need to insert has to be stay in the DataSet, The only way I can see is to use a SqlDataAdapter

HTH. If this does not answer your question, please feel free to mark the post as Not Answered and we will look into it again. Thanks!

Wednesday, March 7, 2012

Quick Query

Our dev database was not built correctly for phone #'s so all of the
sample data or test data (not sure if it is legit) has them in the form
of XXX-YYY-ZZZZ. Is there a query that can remove the dashes from
those values and turn it into XXXYYYZZZZ?
Thanks.Try:
update MyTable
set
Phone = replace (Phone, '-', '')
--
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Toronto, ON Canada
.
<josh.tucholski@.gmail.com> wrote in message
news:1156253610.284442.275620@.i3g2000cwc.googlegroups.com...
Our dev database was not built correctly for phone #'s so all of the
sample data or test data (not sure if it is legit) has them in the form
of XXX-YYY-ZZZZ. Is there a query that can remove the dashes from
those values and turn it into XXXYYYZZZZ?
Thanks.|||update YourTable
set PhoneNumber = replace(PhoneNumber, '-', '')
-Sue
On 22 Aug 2006 06:33:30 -0700, josh.tucholski@.gmail.com
wrote:
>Our dev database was not built correctly for phone #'s so all of the
>sample data or test data (not sure if it is legit) has them in the form
>of XXX-YYY-ZZZZ. Is there a query that can remove the dashes from
>those values and turn it into XXXYYYZZZZ?
>Thanks.