Showing posts with label conditional. Show all posts
Showing posts with label conditional. Show all posts

Friday, March 30, 2012

How do I attach query results to send mail

I have several tasks that I don't want to use conditional failure on. I have a ON ERROR send mail task right now that works. I want to have that send mail task include query results from a separate query. How do I do that?

Peter Cwik

How about dropping the result of the query into a file usig the Flat File Destination and then attaching that file within Send Mail Task?

Just an idea...

-Jamie

|||SSIS is new to me...how do I do that?|||

What I just descibed is slightly advanced because it required the use of expressions. I don't want to try and cover those before you know the basics.

If I were you I would build the bit that populates a flat file first. You'll need a new data-flow. Drop an OLE DB Source Adapter into your data flow. Paste your query into the OLE DB Source Adapter.

Then, drop a Flat File Destination Adapter onto the data-flow. Drag a data path between your source adapter and your destination adapter. Open up the destination adapter editor and accept all the defaults - including building your flat file connection manager.

If none of that makes any sense then i recommend you work your way through the SSIS tutorial provided off the SQL Server install CD.

-Jamie

|||

That part makes sense.

Thanks!

Friday, February 24, 2012

how can i use a conditional where clause in sql statment

I have a store procedure where i need to use conditionel where clause

One possibility would be to make the conditional parameter nullable and then add an IsNull check to your where clause that only evaluates the condition when the parameter is set.|||

hi

you can use coalesce function to implement conditional where clause in sql statement.

for more details please refer this link

http://www.sqlteam.com/item.asp?ItemID=2077

regards