This is very interesting error as I could not found any documentation on-line. It took me nearly 1 hour to figure out what was creating error.
SQL SERVER – SPACE Function Example
A month ago, I wrote about SQL SERVER – TRIM() Function – UDF TRIM() . I was asked in comment if SQL Server has space function? Yes. SELECT SPACE(100) will generate 100 space characters. The use of SPACE() function is demonstrated in BOL very fine. Example from BOL: USE AdventureWorks;…
Read MoreSQL SERVER – Restore Database Without or With Backup – Everything About Restore and Backup
The questions I received in last two weeks: “I do not have backup, is it possible to restore database to previous state?” “How can restore the database without using backup file?” “I accidentally deleted tables in my database, how can I revert back?” “How to revert the changes, I have…
Read MoreSQL SERVER – CASE Statement in ORDER BY Clause – ORDER BY using Variable
This article is as per request from Application Development Team Leader of my company. His team encountered code where application was preparing string for ORDER BY clause of SELECT statement. Application was passing this string as variable to Stored Procedure (SP) and SP was using EXEC to execute the SQL…
Read MoreSQL SERVER – Microsoft White Papers – Analysis Services Query Best Practices – Partial Database Availability
Microsoft TechNet frequently releases White Papers on SQL Server Technology. I have read the following two white papers recently. The summary of its content is here. Analysis Services Query Performance Top 10 Best Practices Optimize cube and measure group design Define effective aggregations Use partitions Write efficient MDX Use the…
Read MoreSQL SERVER – SQL Joke, SQL Humor, SQL Laugh – 15 Signs to Identify Bad DBA
15 Signs to Identify Bad DBA They think it is bug in SQL Server when two NULL values compared with each other but SQL Server does not say they equal to each other. They do not rename the trigger name thinking it will not work after it is rename. They…
Read MoreSQL SERVER – 2005 Collation Explanation and Translation – Part 2
Following function return all the available collation of SQL Server 2005. My previous article about the SQL SERVER – 2005 Collation Explanation and Translation. SELECT * FROM sys.fn_HelpCollations() Result Set: (only few of 1011 records) Name Description Latin1_General_BIN Latin1-General, binary sort Latin1_General_BIN2 Latin1-General, binary code point comparison sort Latin1_General_CI_AI Latin1-General,…
Read MoreSQL SERVER – 2005 – Use ALTER DATABASE MODIFY NAME Instead of sp_renameDB to rename
To rename database it is very common to use for SQL Server 2000 user : EXEC sp_renameDB 'oldDB','newDB' sp_renameDB syntax will be deprecated in the future version of SQL Server. It is supported in SQL Server 2005 for backwards compatibility only. It is recommended to use ALTER DATABASE MODIFY NAME…
Read MoreSQL SERVER – Validate Field For DATE datatype using function ISDATE()
This article is based on the a question from Jr. Developer at my company. He works with the system, where we import CSV file in our database. One of the fields in the database is DATETIME field. Due to architecture requirement, we insert all the CSV fields in the temp table which has all the fields VARCHAR. We validate all the data first in temp table (check for inconsistency, malicious code, incorrect data type) and if passed validation we insert them in the final table in the database. Let us learn about ISDate function in this blog post.