Showing posts with label statements. Show all posts
Showing posts with label statements. Show all posts

Friday, February 24, 2012

BULK INSERT

Hi,

Is there anyway to see the insert statements that are generated by a BULK INSERT statement?
I am getting an error

Bulk load data conversion error (truncation)

But the data is fine it is all characters and I checked it in a hex editor and see no issues.
Thus I want to see the actual inserts to see what it is trying to do?

Thanks in advance!

You could use OPENROWSET function with BULK options. And you could see and check loaded data before inserting:

Code Snippet

SELECT a.* FROM OPENROWSET( BULK 'c:\test\values.txt',
FORMATFILE = 'c:\test\values.fmt') AS a;

|||

You could also add the ERRORFILE = 'file_name' parameter in order to see which rows it's complaining about, and then take it from there.

/Kenneth

Bulk GRANT statements

On occassion I have to set close to 100 seperate
permissions on various objects, and obviously that gets
tedious with enterprise manager.
In my Oracle days I would 1) create a SELECT statement
that prints out the GRANT statements 2) output the SELECT
to a file, and 3) execute the file in the Oracle
equivalent of Sql Query Analyzer.
I know how to create the GRANT statements (1), but I dont
know how to perform 2 and 3 (or whatever is the better
method) in SQL Server 2000.
Any help would be greatly appreciated.
MarkOnce you have granted the permissions using Enterprise
Manager, you can output them to a file using the script
utility in the tools menu. You can then open the script,
edit it, and execute it in Query Analyzer.
Bill
>--Original Message--
>On occassion I have to set close to 100 seperate
>permissions on various objects, and obviously that gets
>tedious with enterprise manager.
>In my Oracle days I would 1) create a SELECT statement
>that prints out the GRANT statements 2) output the
SELECT
>to a file, and 3) execute the file in the Oracle
>equivalent of Sql Query Analyzer.
>I know how to create the GRANT statements (1), but I
dont
>know how to perform 2 and 3 (or whatever is the better
>method) in SQL Server 2000.
>Any help would be greatly appreciated.
>Mark
>.
>