Cannot perform bulk insert. Invalid collation name for source column 1 in format file ‘C:bcp.fmt’.

It took me a while to finally figured what what went wrong to fix the above error. The problem is my bcp.fmt needs to have an empty line at the last row. The first screen capture is the one before I added the empty line and the second screen capture is the one after I Read more about Cannot perform bulk insert. Invalid collation name for source column 1 in format file ‘C:bcp.fmt’.[…]

“SET NOCOUNT ON” vs “SET NOCOUNT OFF”

Let’s try this out. First, open your SQL Query Analyzer. Then, run these three lines of code. (I assume your SQL Server 2000 has default Pubs database). Use Pubs SET NOCOUNT ON SELECT au_lname FROM authors Then, change from SET NOCOUNT ON to SET NOCOUNT OFF and run them. Use Pubs SET NOCOUNT OFF SELECT Read more about “SET NOCOUNT ON” vs “SET NOCOUNT OFF”[…]

Execute a stored procedure from another stored procedure

You can execute a stored procedure from another stored procedure. This means that you can create a common stored procedure so that any stored procedure which needs this common stored procedure can execute it. Example, you have these three stored procedures. One is a common one. The other two are normal one. sp_update sp_delete sp_common Read more about Execute a stored procedure from another stored procedure[…]

Convert DateTime Data Type

(This example was done using SQL Query Analyzer in SQL Server 2000) Say you have this table below, product_type log_datetime xbox 2008-06-11 16:26:46.000 xbox 2008-06-13 16:30:09.653 psp 2008-06-14 16:28:08.000 ps 2008-06-16 16:21:40.000 And you would like to display log_datetime in different format, how do you do it? One way is to do the formating at Read more about Convert DateTime Data Type[…]