Is there any option to execute the netezza host commands from inside a stored proc.
I'm trying to execute sendMail command from Netezza proc.
Not directly in stored procedures, no. You can define a UDX that can interact with the host system.
Related
I was wondering if it is possible for SQL Server to check a directory for files and run a stored procedure. I did some research and found this, but I am wondering if there is a way to do what I want WITHOUT SSIS.
EDIT: After reading my post, I realized I should have been more specific. Is there a way to AUTOMATICALLY or set SQL Server to check for files in a directory and run a stored procedure?
You can use xp_cmdshell to run file related commands. To get a directly listing:
exec xp_cmdshell 'dir *.csv';
You can also use bulk insert to load a file from disk into a table and take actions based on the loaded contents.
Normally you'd use the File Watcher Task with SSIS. But you can also use SQL Server Agent to schedule a task for periodic execution, schedule a task with Windows Task Scheduler, or configure a stored procedure to runs at startup with sp_procoption that pauses (using waitfor) between processing times.
I have a collection of .sql files containing ddl for various database objects.
For example:
User.sql
Group.sql
GroupUser.sql
Is there a way I can use a stored procedure to easily/elegantly load/execute these files in sequence? For example, GroupUser.sql depends on the existence of User and Group, so I need to execute the .sql files in the order listed above.
I know I could concatenate the contents of all of the .sql scripts above into a stored procedure, but I would prefer to take a more modular approach. I could also put each script into its own stored procedure but I'd rather not clutter the stored procedure collection in my app database with DDL setup scripts.
From SSMS, go to the "Query" menu, and select "SQLCMD Mode". Once there, you can run commands like this. I script out stuff like this all the time.
use test
go
:r "D:\SomeDataDirectory\SomeSQLFile.sql"
EDIT: Didn't see you wanted to do this within a stored procedure. That's a bit of a dicey proposition. Assuming you have permissions to execute it, you could put the same SQLCMD code in calls to xp_cmdshell, but in many circumstances that won't be an option for you unless you've got admin-like permissions on the server.
Can I define a Server Job as Oracle Database Procedure?
I will need to schedule running a database procedure using Siebel Server Jobs.
Thanks in Advance.
No you cannot do that. If you are asking something like triggers that is a separate thing.
There is currently no Direct Method to run a DB stored procedure. The common way of implementing this is through the command line and calling SQL Plus. In this tutorial it's explained in a step-by-step way. This will allow you to create a business service and use it in a workflow that can then be used to power a Siebel Job.
You can do this way on Unix servers:
1.Create a SQL script file on Siebel server(s) depending on your component definition on a particular server.
exec my_package.MY_STORED_PRC;
2.Call the file inside your BS:
Clib.system(“sqlplus $my_user/$my_password#dbname #//SBA_81/siebsrvr/bin/my_stored_proc_caller.sql”);
3.Define an RCR template, calling the BS/WF RunProcess:
4.Create RCR with scheduling time & start it.
You can also call the sql file inside a shell script file & invoke shell script file
Shell script file: my_shell_file.sh
sqlplus -S $my_username/$pwd#db_instance "#"my_stored_proc_caller.sql"
Give execute permission to the file.
Then execute it inside BS:
Clib.system(“/sieb/server/path/my_shell_file.sh")
Hi Please try this option by executing OOB BS "EAI ODBC Service" method "Execute Procedure". Hope it will help you
I have created a stored procedure suppose sp_1 on a server say server1 and i want to use the output of this procedure as a input to another stored procedure defined in another server say server2.
I am creating a DTS package for this using DTS designer. What would be my steps to achieve this?
In DTS you can do:
EXEC dbo.proc1 ?, ?
DTS is going away (Its not supported in 2012 and on). For your sake and others who will have to maintain your code learn SSIS which is what you want to use. In SSIS you can use an OLE DB command which has input and output parameters.
Let's say I have a number of "autoexec" stored procedures, i.e., marked with:
exec sp_procoption 'myproc', 'startup', 'ON';
Is there a way to start SQL Server so that the autoexec procedures are not executed at startup this time? I need to do this sometimes for certain maintenance operations.
Thanks.
From the fine manual.
Although stored procedures are set for automatic execution
individually, the SQL Server scan for startup procs configuration
option can be set using sp_configure to prevent all stored procedures
from executing automatically when SQL Server starts. To skip launching
these stored procedures, specify trace flag 4022 as a startup
parameter. If you start SQL Server with minimal configuration (using
the -f flag), the startup stored procedures are not executed. For more
information, see Trace Flags.