Saturday, May 19, 2012

Retrieve permissions on SQL Server database

August 22, 2010 by · Leave a Comment 

SQL Server permissions can be granted to on an object level (schema, database, database objects). In newer versions of SQL Server permissions can be given to user at a more granular level.

How to Improve I/O performance for SQL Server

August 22, 2010 by · Leave a Comment 

  If underline I/O architecture system is working properly then every time SQL Server do some transaction (Read/Write) it can do it without waiting. But if load on the system is up, then SQL transaction have to wait for their turns for processing. This can significantly reduce SQL Server performance. There is a much greater [...]

Import CSV file in SQL Server

May 27, 2010 by · Leave a Comment 

Importing a CSV(Comma Separated File) in SQL server is a very common task, and most of us use the Import /Export feature of SQL server to do this. Import/Export feature has SSIS (SQL Server Integration Services) as it backbone and works great with most of the Databases, file types etc. But today we are going [...]

0x8002801D Library not Registered.. Cannot create any BI project.

February 14, 2010 by · Leave a Comment 

  An annoying error coming up while creating any Business Intelligence project from SQL studio. Error says that it cannot open a specific temp file. I have deleted all my BI settings but not good enough for creation of a BI project. Reparing SQL server installation also did not work also. Cause: Some installation/uninstallation have [...]

Removing Duplicates through SQL Query

February 14, 2010 by · 1 Comment 

Suppose we have a table in SQL Server, that has duplicates in it. CREATE TABLE T1 ( ProductName varchar(50) ) INSERT INTO T1 VALUES (‘Computer’), (‘Computer’), (‘Printer’), (‘Printer’), (‘Printer’), (‘Scanner’), (‘Scanner’), (‘Scanner’), (‘Scanner’), (‘Camera’), (‘Flash Drive’), (‘Flash Drive’) now use the following query, that will remove duplicates in the temporary table that we just created: [...]

Calculating difference of dates in Oracle

November 18, 2009 by · Leave a Comment 

How to calculate difference between two dates in oracle, as subtraction of dates returns numeric value as difference. With some slight changes/enhancements we can track back the subtraction values to some readable date formats: Here are some examples, these can also be amended for user convenience: SQL> SELECT floor(((date1-date2)*24*60*60)/3600) 2 || ‘ HOURS ‘ || [...]

ORA-38029 : object statistics are locked Recently

November 5, 2009 by · Leave a Comment 

This error comes when analyzing tables in oracle. Basic issue in this error is  when you import table without data i.e structure/schema only, oracle will lock table statistics. You can view all the locked tables in schema by executing following query: select table_name, stattype_locked from dba_tab_statistics where owner = ‘MBS’ and stattype_locked is not null; [...]

SqlBulkCopy – Bulk Insertion in SQL Server from .NET

November 5, 2009 by · Leave a Comment 

Many a times there come a scenario when you have to insert large number of records in sql server. There are number of ways to implement this scenario: through looping techniques to call insert statements for one record at a time. Serialize the data in CSV or XML format and send them as a parameter [...]

Write a Custom SQL Scripter (Generating bulk insert, update statements)

November 5, 2009 by · 1 Comment 

There are always some static tables in our database that needs to always have some default values in them, for our custom application development. Usually a huge amount of data resides in these tables because they are slowly changing dimension fields. So when it is time to transfer this data the question arises how to [...]

Creating Table dynamically in Oracle Procedure

November 5, 2009 by · Leave a Comment 

How can we create a table inside an Oracle procedure. "CREATE TABLE tableName AS". We cannot execute this statement in procedures because upon creation of procedure it would give syntax error. We can implement this with the help of EXECUTE IMMEDIATE command and then dynamically create table. create or replace procedure Proc1 as begin execute [...]