I’m trying to use this in Microsoft SQL Server 2008 R2: But I get an error: IIF(…) is not a recognized built-in function name Is IIF() only compatible with a later version? Is there an alternate function I can use? Answer IIF comes from SQL 2012. Before then, you can use CASE:
Tag: tsql
FULL OUTER JOIN vs. FULL JOIN
Just playing around with queries and examples to get a better understanding of joins. I’m noticing that in SQL Server 2008, the following two queries give the same results: Are these performing exactly the same action to produce the same results, or would I run into different results in a more complicated example? Is this just interchangeable terminology? Answer Actually
SQL performance MAX()
Just got a small question. When trying to get a single max-Value of a table. Which one is better? or I’m using Microsoft SQL Server 2012 Answer There will be no difference as you can test yourself by inspecting the execution plans. If id is the clustered index, you should see an ordered clustered index scan; if it is not
SQL Server 2008 – Email notifications
I have a SQL server / database locally and accessed through ip etc… What I want to know is how to send emails directly from the server (when n happens)? Answer You can use Database Mail. To send e-mails via SQL Server you can use the following stored procedure: sp_send_dbmail Or how to configure a SQL agent to send mail
Parse SQL Server Data
I used SSIS and [SharePointListAdapters][1] [1]: http://sqlsrvintegrationsrv.codeplex.com/releases to import data from my SharePoint 2010 list and put it into SQL Server 2008 table. TThere are roughly 500 rows of data. Now the challenge is to parse data appropriately. I have a couple of columns that have html tags around them. For e.g., Column Project Desc has data like Project Desc
how to use like and between in where clause in same statement?
Im trying to find a set of results in a database based on dates. The dates are stored as varchars in the format dd/mm/yyyy hh:mm:ss. What i would like to do is search for all dates within a range of specified dates. For example i tried: Is something like this possible or is there a better way of doing this
SQL Server: backup all databases
I was wondering if there was any way of making a backup of an entire SQL Server (we are using SQL Server 2008) at regular intervals to a specific location. I know we are able to backup single specific databases but for ease of use and not having to set up a backup each time I want a new database,
In a currency exchange rate what is the maximum number of decimal places used?
I need to store currency exchange rate data in the SQL 2008 database. I would like to keep rate as a decimal data type in the database. One thing I am not sure about, is how many decimal places to give (e.g. decimal(18, ?)). Since, I will be using this service as a source: http://openexchangerates.org/latest.json. There, it seems that the
How to use regular expression in T-SQL?
For example: where strword match with {%{J{GC * GC}J} or strword={%{J{GC * GC}J}
How to rewrite IS DISTINCT FROM and IS NOT DISTINCT FROM in SQL Server 20008R2?
How do you rewrite expressions containing the standard IS DISTINCT FROM and IS NOT DISTINCT FROM operators in the SQL implementation in Microsoft SQL Server 2008R2 that does not support them? Answer The IS DISTINCT FROM predicate was introduced as feature T151 of SQL:1999, and its readable negation, IS NOT DISTINCT FROM, was added as feature T152 of SQL:2003. The