here is my scenario:
I have an entry screen, where an Operator requests to download a recipe (Entity “E1”)
“E1” sends a request to SQL Server to prepare the recipe (Entity “E2” a SP on SQL Server)
“E2” prepares the recipe data and sets it in a table for Wonderware to download (Entity “E3”)
“E3” Currently has a script that keeps polling the table to find out if data is available for it at a 2” interval.
What I am trying to obtain is this:
“E1” sends the request to SQL Server to prepare the recipe (Entity “E2”)
“E2” prepares the recipe data and sets it in a table for Wonderware to download (Entity “E3”)
“E2” sets a value in a specific Field Attribute of “E3” named (BoolRecipeAvailable) to true, (maybe call a DLL to do it?)
“E3” has a script that gets activated by BoolRecipeAvailable going to True or on a DataChange.
I have a Wonderware toolkit that can read/write inside a running Galaxy.
How can I call one of its methods from the SQL Server stored procedure that prepares the requested data? This would allow me to use the DataChange or OnTrue events to start the script performing the download, without having to be time-activated.
Anyone ever ran into a similar situation?
Thank you,
Marco
The current system has a script that every 2" queries a SQL table to check if there is data prepared for it, but due to the fact that 'When' is determined by the operator, most of this script runs are useless.
Related
I am building a Windows RT store app connecting with SQL server from client side database, and using sync framework to sync data between the two. Two scopes are defined:
1) DefaultScope: include all tables and all columns
2) TemplateScope: all tables and some of them has filter clause
(filter by id etc)
I run the provision script to provision sql server database and generate the server and client side code, and it works now, but only for one scope.
For example, if I start the sync using DefaultScope, the client database is generated and data is download, everything works. but If the templateScope is used after that, the error "Scope info not found" is returned.
If I start from TemplateScope, then it worked.
I checked the server side and client side database, both scope info looks fine.
Any thoughts?
I am having a problem with a data flow task in an ssis package i am trying to build. The objective of the package is to update tables situated in our local server using a connection to a distant server containing the source of the data, through a vpn connection.
There are no problems for tables which are re-downloaded entirely.
But some of the tables must be updated for real. What I mean is they're not re-downloaded. For each of those tables, I have to check the maximum value of the date column in our local server (int YYYMMDD type) and ask the package to download only the data added after that date.
I thought about using a scalar (#MAXDATE for ex) but the issue is, I have to declare this scalar in a session with our local server, and I cannot use it as a condition in an OLE DB Source task, because the latter implies a new session, this time with the distant server.
I can only view the database on the distant server and import it. So no way to create a table on it.
I hope it is clear enough. Would you have any tips to solve this problem?
Thank you in advance.
Ozgur
You can do this easily by using an execute SQL Task, a Data Flow task and one variable. I would probably add some error checking just in case no value is found on the local system, but that depends very much on what might go wrong.
Assuming VS2008
Declare a package level variable of type datetime. Give it an appropriate default value.
Create an Execute SQL Task with a query that returns the appropriate date value. On the first page of the properties window, make sure the Result Set is set to "Single Row." On the Result Set page, map the date column to the package variable.
Create a Data Flow task. In the OLE DB Data Source, write your query to include a question mark for the incoming date value. "and MaxDate>?". Now when you click on the Paramaters button, you should get a pop-up that allows you to map "Parameter0" to your package level variable.
Any simple way of solving the problem where you have a component and get the same log massage more than one time due to the fact that the component is nested inside other components (like a container and a data flow for example)
I found this, where MS say it wont do anything about it, but its from 2007.
I dont really want to do the workaround suggested, seems a lot of work.
For logging, if you chose to log to sql server, SSIS will create a Stored Proc
(SQL 2005)
Proc Name: dbo.sp_dts_addlogentry
Table Name: dbo.sysdtslog90 (user table)
(SQL 2008)
Proc Name: dbo.sp_ssis_addlogentry
Table Name: dbo.sysssislog (system table)
You are free to modify this to filter out log entries (sql will recreate it if it is missing, but will not overwrite a self written version of the same name.)
The system generated version is simply an insert into of the parameters sent to the proc by SSIS.
You can add logic to follow the chain up the executionid to find parent objects and suppress logging for entries that have already been logged (you will want to handle the OnError event name in your code for this) I usually pass OnPreExecute, OnPostExecute, OnError, and OnTaskFailed events into my logging proc. By default, the proc also gets PackageStart and PackageEnd events.
That being said, I let all of these log fully to the table in sql then use summary and detail report to check the logging and see errors. My report filters to show only the one error for each occurance rather than filtering on the input into the log file. I also log all of my SSIS packages into a single database for configurations and logging that is included in every SSIS package.
I have a bunch of stored procs doing the business logic job in a SQL Server instance within a web application. When something goes wrong all of them queue a message in a specific table (let's say 'warnings') keeping track of the error severity and issue description. I want the web application using the stored procs to be able to query the message table at the end of the run but getting a list of the proper message only, i.e. the message created during the specific session or that specific connection: so I am in doubt if
have the web application send to the db a guid to INSERT as column value in the message records (but somehow I have to keep track of it in several stored procs running at the page level, so I need something "global")
OR
if I can use some id related to the connection opened by the application - and this would be definitely more sane. Something like (this is pseudo code):
SELECT #sessionid = sessionid FROM sys.something where this = that
Have some hints?
Thanks a lot for your ideas
To retrieve your current SessionId in SQL Server you can simply execute the following:
select ##SPID
See:
http://msdn.microsoft.com/en-us/library/ms189535.aspx
I'm developing a asp.net MVC 3 web application project. The project is simple, it provides a web page listing stored procedures in SQL Server. when user selects a stored procedure and hit "run" button, it is invoked to execute in SQL Server and return some execution result.
My stored procedure is logically divided into several steps, say 10 steps, each step prints a message like step 1: doing A..., step2: dong B..., until step 10: done or step 10: fail. (with error message).
I don't want the user just hang on to wait until stored procedure finishes and just see the final result message. I want them to see some kind of live execution of stored procedure, so that user is well updated of where the stored procedure is.Some stored procedures are quick and take few seconds to finish, some are very slow and take even 1 hour to finish.
Now the question is: how could I push theses step messages from SQL Server to web application, so that in web browser, user can see each step message get printed in real-time fashion?
I search lots of info, the best i can see is model controller notifies view once there's change in model, but still need model controller to pull from SQL Server, I don't see any real push from SQL Server to web application. Your advice is highly appreciated.
One approach would be to create a log table at the start of the procedure, with a unique name. The MVC code would display a grid or other element showing this log table, the stored procedure would simply add rows to the table after each step is complete...
Grab the session ID of the connection
The procedure creates a file called LOG_SessID
The MVC opens the table and uses the Meta Refresh or a Timer to redisplay the page
Each redisplay checks to see if the table still exists, if not, it
assumes the procedure is done and prints the appropriate message
One possible solution can be that you break your SP into steps and call each Step's SP and update the User screen (even have separate MVC VIEWS/PARTIAL VIEWS for each step's success and failure) based on the result!