SharePoint Diva

March 10, 2009

Using SQL inside Workflow

Filed under: SQL, SharePoint — sharepointdiva @ 10:38 pm
Tags: , , , , , ,

Thanks to iLove SharePoint for creating the “Execute SQL” action.

With it I was able to create a workflow against the add/change event in my document library to create a link to my equipment page based on if there is any information to link to.

I first store my select statement in a variable so I can log it to the history file (this was helpful with debugging the workflow.)

SELECT COUNT(DWG_NAME_) FROM AccessDatabase…[AccessTable] where DWG_NAME_ = ‘[%DocumentLibrary:FileName%].DWG’

Then using the Execute SQL action, I can query the Access Database to see if there is anything I want to link to and store the results in a variable. I can then also show how many items there are in the hyperlink text. (The connection string I used was: Data Source= OFFICESERVER;Initial Catalog=WSS_Content;Integrated Security=SSPI. This particular server uses Studio Express on the same server as SharePoint.)

So if there is something to link to, I create the URL text: Store Helpful text-[%Variable: SQLResult%] in Variable: URLText.

Then I build the URL string:

And store it in the hyperlink column of my document library. The user will know that only the drawings with links have something in the Access Database to look at:

1 Comment »

  1. You have more Examples for “Execute SQL Action”?

    I need learn more.

    Please

    Thanks.

    Comment by Francisco Castillo — March 26, 2009 @ 8:45 pm | Reply


RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.