Category: SQLServer

  • When does grant statement take into effect

    In both Sql Server and Oracle, permission changes to a user take into effect right away, even when said user is connected at the time you made the change. In MySql, it is a little different, depending on how the permissions are given. If you use the GRANT statement, then it takes into effect right…

  • Total row counts of all tables in a Sql Server database

    Sometimes you may want to know the total row counts of all tables in a database. The script below will give you a rough idea. However, it is not guaranteed to be accurate, though. It works in both Sql Server 2000 and Sql Server 2005. select sum(rowcnt) from sysindexes inner join sysobjects on sysindexes.id=sysobjects.id where…

  • Executing sql scripts using command line tools

    SQL Server 2005 has a command line tool named sqlcmd. MySQL has a command line tool named mysql. Oracle has a command line tool called sqlplus. They can all be used for interactive query processing and batch scripts processing. They do similar things, albeit in different ways. They are functionally equivalent. For SQL Server 2005,…

  • desc is sp_columns in Sql Server

    In Oracle and MySql, to get the column name and data type of a table, you can use: desc MyTable or describe MyTable The equivalent of desc in Sql Server is sp_columns. Therefore, run the command below will get similar results: sp_columns MyTable

  • Troubleshoot Sql Server cluster and ClusterRecovery

    With some San disk configuration and drive letter changes, a two-node 64-bit Sql Server 2005 cluster on Windows 2003 boxes would not start, as evidenced in Cluster Administrator. Here are some errors in Event Viewer: Sql Server application error in Event Viewer [sqsrvres] OnlineThread: Error 435 bringing resource online. Sql Server Agent [sqagtres] CheckServiceAlive: QueryServiceStatus…