SQL Server 2000 - Can it perform bulk insert operations? - sql-server-2000

Is it possible to perform a bulk insert with SQL Server 2000?
If so, please explain how. Third party tools/add-ons are not likely to be allowed.

Yes, see this MSDN article: http://msdn.microsoft.com/en-us/library/aa225968(v=sql.80).aspx

Related

SSIS performance vs OpenQuery with Linked Server from SQL Server to Oracle

We have a linked server (OraOLEDB.Oracle) defined in the SQL Server environment. Oracle 12c, SQL Server 2016. There is also an Oracle client (64 bit) installed on SQL Server.
When retrieving data from Oracle (a simple query, getting all columns from a 3M row, fairly narrow table, with varchars, dates and integers), we are seeing the following performance numbers:
sqlplus: select from Oracle > OS File on the SQL Server itself
less than 2k rows/sec
SSMS: insert into a SQL Server table select from Oracle using OpenQuery (passthrough to Oracle, so remote execution)
less than 2k rows/sec
SQL Export/Import tool (in essence, SSIS): insert into a SQL Server table, using the OLEDB Oracle for source and OLEDB SQL Server for target
over 30k rows/second
Looking for ways to improve throughput using OpenQuery/OpenResultSet, to match SSIS throughput. There is probably some buffer/flag somewhere that allows to achieve the same?
Please advise...
Thank you!
--Alex
There is probably some buffer/flag somewhere that allows to achieve the same?
Probably looking for the FetchSize parameter
FetchSize - specifies the number of rows the provider will fetch at a
time (fetch array). It must be set on the basis of data size and the
response time of the network. If the value is set too high, then this
could result in more wait time during the execution of the query. If
the value is set too low, then this could result in many more round
trips to the database. Valid values are 1 to 429,496, and 296. The
default is 100.
eg
exec sp_addlinkedserver N'MyOracle', 'Oracle', 'ORAOLEDB.Oracle', N'//172.16.8.119/xe', N'FetchSize=2000', ''
See, eg https://blogs.msdn.microsoft.com/dbrowne/2013/10/02/creating-a-linked-server-for-oracle-in-64bit-sql-server/
I think there are many way to enhance the performance on the INSERT query, I suggest reading the following article to get more information about data loading performance.
The Data Loading Performance Guide
There are one method you can try which is minimizing the logging by using clustered index. check the link below for more information:
New update on minimal logging for SQL Server 2008

How to capture truncate statement information in SQL Server 2012

I would like to capture the truncate statements information along with the user/Login information for all database in my production server.
Example:
Use mydb
go
truncate table deleteme_table
I would like to capture the information into the table like the below
Table Operation Database Login Time
deleteme_table Truncate mydb sandeep.pulikonda 17-12-2014 17:50:00
If the above scenario is not possible please suggest possible ways to capture it
I am using SQL Server 2012 Standard version. So granular level audit are not supported for that version.
you can use the SQL Server Audit functionality and add an audit for those queries.
this article explains in detail how to obtain this.
Another good way of profiling your SQL Server is using SQL Profiler. Here is a SO question similar to yours and an answer describing how to use SQL Profiler to achieve the results.
SQL Server Profiler - How to filter trace to only display TSQL containing a DELETE statement?

Adaptation of the merge clauses in SQL Server 2005

I have a code which is up and running but the problem that I have is that it includes a lot of MERGE clauses as it was intended to be run from SQL Server 2008 and forward. But the problem is that a new customer is running SQL Server 2005 and as you know the Merge clause is not available till SQL Server 2008, so my question is if there is not a way to parse the this clauses automatically or if there is another solution (apart from rewriting all the clauses in clasical clauses ) as the customer is not willing to upgrade the DB.
Thanks a lot in advance.
I am afraid that you will need to re-write all of your MERGE clauses for SQL Server 2005.
You can use the 2005 friendly output clause to achieve the same functionality but with more verbose SQL. This approach will also work on SQL Server 2008.
http://sqlserver-tips.blogspot.co.uk/2006/09/mimicking-merge-statement-in-sql.html
You could put together a C# (or whatever) app to parse the merge statements and create insert/update statements from them. I mean, that's a horrible idea, but you can do it...
You'd have to pull out the "ON" part, add it to a check IF EXISTS and the update part, then add the column list to the insert part. You could even programmatically (sic?) create SP params and everything.
Heh. Good luck.

SQL: How do I port sql server database via t-sql scripts

I have to port sql server (2008) database with t-sql scripts. I can generate "create" script per each database object (stored procedure, table) from Sql Server Management Studio (though it looks to take much time)
How do I port data for tables? I'd like to have scripts like that:
INSERT INTO ... VALUES(...)
INSERT INTO ... VALUES(...)
INSERT INTO ... VALUES(...)
...
Can I generate such scripts from Sql Server Management Studio or is there some free 3'rd party utility for that? (I guess there should be).
Thank you in advance!
The (free) SMSS Tool pack addin can generate insert scripts for a DB.
If you're going to be doing bulk inserts of data, I'd suggest using bulk insert. You can do the insert from T-SQL, but I prefer to use the bcp command line utility as I can do both the export and import with minimal change to the run line. Oh... and it runs a lot faster than a bunch of insert statements. Have a look at the documentation and see if it fits your purposes.

SQL Server 2005 or Visual Studio 2005 - writing my first procedure, any tips or good starting points?

I'm about to write my first procedure to check if yesterdays data exists in one database, and if it select some of the data, use a count and insert that data into another database. If the data doesn't exist, then send me an email.
I'm using SQL Server 2005 and I'd like to ask the community for tips or good starting knowledge on smart procedure coding.
Thanks!
Here is an article on MSDN about stored procedures on SQL Serve 2005 that should help.