Category Archives: SQL, Database

Get current user name for any query in SQL server

Just use ‘SYSTEM_USER’. Example: Select SYSTEM_USER Advertisements

Posted in SQL, Database | Tagged , , | Leave a comment

IF temp table exists in SQL Server

Wondering how to know if a temp table already exists in the database. Here is a simple command IF OBJECT_ID(‘tempdb..#temp’) IS NOT NULL DROP TABLE #temp

Posted in SQL, Database | Leave a comment

Oracle and SQL server connection in SSIS: Best provider

Recently, I have been working in a project where I had to make an SSIS package to connect to an Oracle server and load data to a SQL server. After searching a lot and getting through a lot, I figured … Continue reading

Posted in SQL, Database, SSIS (SQL Server Integration Service) | Leave a comment

SQL Bulk Insert

SQL for bulk insert into a table: BEGIN       declare @s varchar(400)      set @s = ‘BULK Insert my_temp_table FROM ”’                           + @file_name  + ”’ WITH (                                                                                         FIELDTERMINATOR = ”,”,                                                                                         ROWTERMINATOR = ”\n”,                                                                                         FIRSTROW = 1                                                                                       … Continue reading

Posted in SQL, Database | Leave a comment

Deleted database log(.ldf) file of SQL Server? Need to Restore database?

Let’s say…one of your DB log file got too large and u need to make some space in your hard disk very quickly. So, u like to delete a .ldf file/log file of a database of MS SQL server. First, you need … Continue reading

Posted in SQL, Database | 3 Comments