weblogs.com.pk

Proud To Be Pakistanis!
Welcome to weblogs.com.pk Sign in | Join | Help
in Search

Browse by Tags

All Tags » Databases » SQL Server
  • Knowing the counts of table entries in SQL Server

    Here's the query to know the counts of the table entries in SQL Server select object_name(object_id), row_countfrom sys.dm_db_partition_statswhere index_id < 2order by row_count desc
    Posted to Khurram Aziz (Weblog) by khurram on February 28, 2013
  • Sharepoint and SQL Server Reporting Services

    SQL Server 2005 Reporting Services SP2 or later can be integrated with Sharepoint. Setting it up is bit tricky. http://msdn.microsoft.com/en-us/library/ee384252.aspx URL is must read to troubleshoot the issues. For me following worked Ensure only Windows Integrated Authentication is checked on http://server/ReportServer DisableLoopBackCheck ...
    Posted to Khurram Aziz (Weblog) by khurram on January 2, 2010
  • Disallowing Running the Stored Procedure in Parallel

    I wrote a stored procedure a while back; it manipulates the database of a legacy and proprietary application. Few assumptions were taken like the stored procedure will always get invoked by the job and job doesn't run in parallel. Few weeks back there was a requirement to let the user do that operation from the web on demand; which triggered the ...
    Posted to Khurram Aziz (Weblog) by khurram on October 20, 2009
  • Tsql : Update From / Self Join

    The other day I received a query on how to update rows in a table having from clause and self join needs to be used…I thought its interesting scenario and should document it for future references… Let me explain the problem with a scenario…Lets consider a table in which hierarchy is implemented using Parent / Child to self; something like create ...
    Posted to Khurram Aziz (Weblog) by khurram on October 8, 2009
  • Date Calculations in TSQL

    Sometime while implementing some date/time specific business logic; we need to do some processing on datetime data; e-g trimming away the time, knowing the start of month datetime value. Instead of converting the datetime data to string and then doing some string processing; we can use the SQL Server’ built in functions like dateadd and datediff ...
    Posted to Khurram Aziz (Weblog) by khurram on September 30, 2009
  • If-Else Like Behavior in Where Clause

    .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, ''Courier New'', courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: ...
    Posted to Khurram Aziz (Weblog) by khurram on September 28, 2009
  • Knowing current SPROC name

    Instrumentation though usually a ''non-functional requirement''; but its considered to be critical especially in ''enterprise class application''. For this we usually need to know what is the current part of code being executing; against which we can log some info. Same applies to data-tier; thankfully TSQL has required functionaliy. This is ...
    Posted to Khurram Aziz (Weblog) by khurram on November 2, 2006
  • TSQL :: Comparing multiple fields

    Sometimes you want to select from one list the items that exist (or don’t exist) in the second row; and for the comparison you want to use multiple rows. This is common in scenarios where you want to remove duplicate values. You might wish to write something like this in TSQL (This is just an example; not very practical one; but I guess it will ...
    Posted to Khurram Aziz (Weblog) by khurram on June 18, 2006
  • Tsql :: Checksum

    Comparing Checksum is one of the straight forward techniques to know if two things are different or not, especially when you are comparing some vector quantities. SQL Server 2005’s TSQL has two new relevant functions in this regard, checksum() and checksum_agg() Consider a test table having some values. Using checksum() you can have a computed ...
    Posted to Khurram Aziz (Weblog) by khurram on May 16, 2006
  • Can we use stored procedures in View?

    Well I have not gone through all the options yet; but I was able to did something that solved the problem at hand. The database at hand was exposed only through stored procedures; but one developer wanted to have a view; being new to Perl on Unix; he hasn’t yet explored how to execute stored procedures. He asked me to setup few views for him ...
    Posted to Khurram Aziz (Weblog) by khurram on March 21, 2006
  • Passing Array To Stored Procedures

    There are some scenarios; where you want to pass array to stored procedure. In SQL 2000; it was not possible. Different work-around was presented; like passing values as string and then parsing them out; passing data as XML and then using MSXML OLE automation object in SQL Server (sp_OACreate/sp_OADestroy). Both have the pit falls; parsing ...
    Posted to Khurram Aziz (Weblog) by khurram on March 8, 2006
  • sysxlogins

    SQL Server 2000 had certain system tables; using them was not encouraged and neither were they documented publicly. However no one was stopping you to use it and people have used it to do different things. I myself have used few of them; and today I discovered a “breaking change” between SQL 2000 and SQL 2005 regarding sysxlogin. Technically ...
    Posted to Khurram Aziz (Weblog) by khurram on February 7, 2006
  • XACT_ABORT

    Using transactions in SQL Server is sometimes tricky. Here is today’s learned lesson. If you set xact_abort to on; you don’t need to rollback the transaction; it gets automatically rolled back in case of any error. One thing that can lead you to problems is; that transactions get rolled back when you close the connection. If you want to perform ...
    Posted to Khurram Aziz (Weblog) by khurram on January 23, 2006
  • Reporting Services :: ReportServerUrl

    If you have configured SQL Services Reporting Services, and specifically has set ReportServerUrl in Report Manager’s configuration, you might get the following exception. The configuration file contains an element that is not valid. The ReportServerUrl element is not a configuration file element If this is the case; erase the value being set ...
    Posted to Khurram Aziz (Weblog) by khurram on January 3, 2006
  • Attaching/Detaching SQL database :: sp_ChangeObjectOwner

    If you detach your database and attach it to another SQL Server instance; chances are that same logins doesn’t exists. If there are some database objects in a database which are not owned by dbo but by some login which might not exists in the second server, you should change owner of such objects to dbo sp_changeobjectowner @objname = ...
    Posted to Khurram Aziz (Weblog) by khurram on January 2, 2006
  • To Indexed View Or Not?

    This year; we computerized the attendance system of our company. And as the year is ending; everyone is expecting a yearly attendance report. When system was made; it was not stressed test; and today; when I evaluated the report to see it will work when people will view it tomorrow; it didn’t work (as expected </smile>) The report is based ...
    Posted to Khurram Aziz (Weblog) by khurram on December 31, 2005
  • SQL Server 2005 :: The First Impression

    I strongly recommend not configuring SQL Server 2005 Developer Edition and SQL Server 2005 Express on your development machine, unless you have lot of memory and system resources. Don’t install SQL Server 2005 Management Studio and SQL Server management Studio Express CTP on a single machine; you will get weird exception in SQL Server 2005 ...
    Posted to Khurram Aziz (Weblog) by khurram on December 29, 2005
  • SQL Server 2005 Express :: Remote Desktop

    In last few posts, here and here; I had been complaining that I am not able to configure the SQL Server 2005 Express Edition on machines which are part of the active directory. Well; there was one stupid reason; I was doing that experiment in afternoon from my home machine. VWD/SQL Express were working fine on my home PC; because I was ...
    Posted to Khurram Aziz (Weblog) by khurram on November 30, 2005
  • SQL Server:: Corrupt sysdepends can create problem in DTS

    SQL Server internally keeps tracks of database objects and their inter-dependencies. In routine operations; I guess this information is not being used; however if you Script your database (SQL-DMO API) this information is used to order the DML queries. The information of the database objects and their inter-decencies are stored in two special ...
    Posted to Khurram Aziz (Weblog) by khurram on September 9, 2005
  • SQL Server Reporting Services :: Security Settings Not Working

    I love SQL Server Reporting Services. It’s very fine platform; has number of options for accessing reports; like web based portal; Sharepoint webparts; URLs and web services. Above this all; it provides extendibility at multiple points; like data providers; data rendering; report designing; report delivery and so forth.   Few weeks back; I ...
    Posted to Khurram Aziz (Weblog) by khurram on July 22, 2005
  • Reporting Services :: Report Manager giving 401 after installing Service Pack 1 on Windows 2003

    Installing Service Pack 1 on the Windows 2003 box resulted problem in accessing Report Manager web site of SQL Server Reporting Services. We were having “The request failed with HTTP status 401: Unauthorized”   I checked logs of IIS, Report Manager and system’s event logs, but no use. Reporting Server web service was accessible just fine; ...
    Posted to Khurram Aziz (Weblog) by khurram on June 2, 2005
Powered by Community Server (Personal Edition), by Telligent Systems