Skip to content

Tag: sql

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 a…

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…

SQL count(*) performance

I have a SQL table BookChapters with over 20 millions rows. It has a clustered primary key (bookChapterID) and doesn’t have any other keys or indexes. It takes miliseconds to run the following query However, it takes over 10 minutes when I change it like so or Why is that? How can I get select count(*) …

SQL set floating point precision

For a SQL int that is being converted to a float, how do I set the precision of the floating point number? This is the selection I would like to truncate to two or 3 decimal places: Thanks! Answer In TSQL, you can specify two different sizes for float, 24 or 53. This will set the precision to 7 or

PDO Exception Questions – How to Catch Them

I’m using PDO to re-write a website interface for a database. I used to use the mysql extension, but I had never bothered with error handling, and the few error handlers I had were basically copy-paste. Now I’d like to do this right. However, I’m having issues catching the errors how I&#8217…

how to cast datetime2 as datetime

I’m trying to convert datetime2 to datetime in order to create a standard between different sources using only SQL or SSIS Take the following SQL query as example: SELECT CAST(offer_start_date AS …