Category: SQL

  • Pagination Query for SQL Server

    In recent past, we got few problem when we need to do Pagination with SQL Server. I specially got frustrated when I saw that MySQL server has “limit” word that does pagination work in MySQL in best known manner for me, BUT microsoft didn’t consider that option yet. But today I found a method for…

  • MySQL “Server has gone away” error

    A useful like to know the reason of “Server has gone away” error of MySQL. http://blog.taragana.com/index.php/archive/mysql-tip-mysql-server-has-gone-away-or-lost-connection-to-server-during-query-fix/ It has very good information on why it happens, so you can check and correct the error.

  • Comparing Date Range (Date Interaction checking through SQL)

    As title says, I was looking to compare User give date range with date range saved in mysql Database. I search internet and found a great  small function that solve this problem for me, though they create a function for some programming language but I use same function in mysql (as per mysql syntax) and…

  • Creating SQL Table from another table

    Often we need to take quick backup of database with data before we can make changes in table. for this I create the image of table within same database, as it is the fastest method. It is one of the reason why one need to create image a table.. or copy one table from another.…

  • Setting/Resetting Auto increment value in MSSQL 2005

    Once you create a table and what to reset autoincrement value of a table to your desire number, you need to set some system table values, which are not available for direct editing. To perform this you need to do following: SELECT OBJECT_ID,OBJECT_NAME(OBJECT_ID) AS TABLENAME, NAME AS COLUMNNAME, SEED_VALUE, INCREMENT_VALUE, LAST_VALUE, IS_NOT_FOR_REPLICATION FROM SYS.IDENTITY_COLUMNS ORDER…