SQL Agent, Create Job

May 11, 2007

Hi

I have a .Net 2.0 application written in VB.Net and I am programatically trying to create a SQL Agent Job, so a user can:

1)  Add SQL Statement to job
2)  Add Schedule to job

Im not sure how you do this or what namespace to use, i would be greate for any help

 Many thanks in advance

View 2 Replies


ADVERTISEMENT

SQL Agent Job Fails-Can't Create Object

Jun 3, 2004

I have read many threads on this issue & tried multiple solutions to no avail.

Here's my environment: SQL 2000, Logged directly into server via VPN (so it should be like I am physically at the server).

I've set up a DTS Package that executes an Access procedure. The package runs fine when I execute manually. When I execute via schedule, it fails on the error "ActiveX component can't create object: 'Access.Application'. The actual statement is:

Set objDB = CreateObject("Access.Application")

I know that Scheduled jobs default back to the SQL Agent permissions. I have reset SQL Agent to use my Windows NT account login so it should have the exact same permissions, etc. that I have when I execute manually?

Any help will be GREATLY appreciated!!!

Thanks mucho,
Brian

View 11 Replies View Related

SQL Server Agent Can't Create A New Session

Jun 7, 2007

I'm not sure what happened, but all of a sudden my SQL Server Agent service won't start. When I try to start it, I get the following error in the event logs:



"SQLServerAgent could not be started. Error creating a new session".



When I look in the Agent log file, i see the following:



Execute permission denied on object sp_sqlagent_has_server_access

Execute permission denied on object sp_sqlagent_get_startup_info

Insert permission denied on object syssession



What happened?



Thanks...

View 1 Replies View Related

Transact SQL :: How To Create Stored Procedure Using Agent Job

May 8, 2015

I have 3rd party application implementation I am doing, if I have stored procedure in one database, can it be copied to other database (newly created) on the same server? I will have the name of old and new database when this will be copied. I do need to automate this copy.

View 10 Replies View Related

Error - Distribution Agent Failed To Create Temporary Files

Sep 17, 2014

I've been using replication for a long while now but have never come across this error. It's a basic transactional replication from ServerA to ServerB, where ServerA is also the distributor. Everything had been running fine on it until yesterday, when this error started popping up and no further transactions could be delivered.

After some quick googling I was able to determine that the distribution agent account needed write access to C:Program FilesMicrosoft SQL Server100Com. According to the MSFT article it's because the distribution agent is running under a non-default profile. I didn't change this. However, what I did change around the time that these errors started occurring was the server's Replication Max Test Size setting. It would be far too coincidental for this to not be the cause, but what I don't understand is *why* that would have changed it.

how do I change this? It is definitely not preferable to create temp files in this directory in our environment.

View 1 Replies View Related

Create The Package On The Server, And Execute Through Sql Server Agent

Oct 24, 2006

Hi,

Some of you guys seem to be gurus with the new Integration Services technology, so I hope someone can lend me some advice, as I haven't worked much with integration before.

Ok, here we go. What I want to do is select some data from my database and export the result to a flat file (really a .csv file with values delimited by semicolons). Sounds like a simple thing to do? Well, I'm sure it is when you know how to do it :) I know I could manage the same thing by writing a C# class that creates that .csv file, but the decision has been made to use Integration Services for these kind of operations.

I created an SSIS project in Business Intelligence Development Studio, and created a package (I defined the task flow etc.). By choosing "Execute package" from the IDE I managed to create the flat file, and everything seemed sweet. However, When trying to execute the package (package.Execute();) from C# code, it only results in a failure. I have read on several sites that this has to do with my program lacking the rights to run the package from the client side. OK, fair enough. I need to create the package on the server, and use an SQL Server Agent to execute the package through the agent.

Can anyone tell me how I need to do this? How can I ensure that the package is created on the sql server instead of locally on my development computer? When I create a new SSIS project the package is already made, and it is created locally on my PC.

I hope someone can give me some help. Even a little nudge would be appreciated ;)

Thanks in advance!

Greenies

View 11 Replies View Related

Execute Sql Server Agent Job Task - Job Immediately Returns Success... However Agent Job Is Still Running???

Nov 30, 2006

when I run a package from a command window using dtexec, the job immediately says success.
DTExec: The package execution returned DTSER_SUCCESS (0).
Started: 3:37:41 PM
Finished: 3:37:43 PM
Elapsed: 2.719 seconds



However the Job is still in th agent and the status is executing. The implications of this are not good. Is this how the sql server agent job task is supposed to work by design.



Thanks,

Larry

View 1 Replies View Related

Snapshot Agent && Log Reader Agent Will Not Start.

Nov 30, 2006

Hi All,

I would appreciate any help here at all. I am pulling my hair out!

I am unable to start the snapshot agent or log reader agent from within SQL management studio. it fails on executing step 2 with unknown username or bad password.

I have checked all account details and they are correctly using my domain admin account. I can connect to SQL using teh same account and it also has sysadmin permissions.

If i copy the step 2 paramters and start from the cmd prompt (again logged in using the same domain account) they both start fine.



Any ideas would be gratefully received.

View 1 Replies View Related

Cannot Start Log Reader Agent And Snapshot Agent

May 18, 2007

I am testing peer to peer replication in our environment. I simulated a three node peer to peer topology and a local distributor.

For some wierd reason I cannot get the Log Reader Agent and snapshot agent to start. The domain account under which SQL Server Agent runs has administrator previlage on the box. I also use a domain account for SQL Server Service. (none of the passwords changed).

This is the error I am getting - "Executed as user: abc. A required privilege is not held by the client. The step failed"

Any ideas???





Also this domain account is a member of



SQLServer2005MSSQLUsers$ServerName$MSSQLSERVER

SQLServer2005MSAgentUser$ServerName$MSSQLSERVER


View 3 Replies View Related

SQL Server Agent Could Not Access Replication Agent

Feb 19, 2007

We just moved source server to newer, bigger box ... Windows 2003 and Active Directory ... Snapshot agent worked but distribution failed ... Same login as on older machine, login is sysadm, used DCOMCNFG to allow ability to launch process ... What are we missing?

View 4 Replies View Related

Sql Agent Not Starting Can We Reinstall Just Agent ?

Feb 7, 2002

SQLServerAgent could not be started (reason: Unable to connect to server '(local)'; SQLServerAgent cannot start).

Is any has the same problem ?

View 6 Replies View Related

Problems On Create Proc Includes Granting Create Table Or View Perissinin SP

Aug 4, 2004

Hi All,

I'm trying to create a proc for granting permission for developer, but I tried many times, still couldn't get successful, someone can help me? The original statement is:

Create PROC dbo.GrantPermission
@user1 varchar(50)

as

Grant create table to @user1
go

Grant create view to @user1
go

Grant create Procedure to @user1
Go



Thanks Guys.

View 14 Replies View Related

Boolean: {[If [table With This Name] Already Exists In [this Sql Database] Then [ Don't Create Another One] Else [create It And Populate It With These Values]}

May 20, 2008

the subject pretty much says it all, I want to be able to do the following in in VB.net code):
 
{[If [table with this name] already exists [in this sql database] then [ don't create another one] else [create it and populate it with these values]}
 
How would I do this?

View 3 Replies View Related

Create Variable To Store Fetched Name To Use Within BEGIN / END Statements To Create A Login

Mar 3, 2014

I created a cursor that moves through a table to retrieve a user's name.When I open this cursor, I create a variable to store the fetched name to use within the BEGIN/END statements to create a login, user, and role.

I'm getting an 'incorrect syntax' error at the variable. For example ..

CREATE LOGIN @NAME WITH PASSWORD 'password'

I've done a bit of research online and found that you cannot use variables to create logins and the like. One person suggested a stored procedure or dynamic SQL, whereas another pointed out that you shouldn't use a stored procedure and dynamic SQL is best.

View 3 Replies View Related

Dynamic Create Table, Create Index Based Upon A Given Database

Jul 20, 2005

Can I dynamically (from a stored procedure) generatea create table script of all tables in a given database (with defaults etc)a create view script of all viewsa create function script of all functionsa create index script of all indexes.(The result will be 4 scripts)Arno de Jong,The Netherlands.

View 1 Replies View Related

Can CREATE DATABASE Or CREATE TABLE Be Wrapped In Transactions?

Jul 20, 2005

I have some code that dynamically creates a database (name is @FullName) andthen creates a table within that database. Is it possible to wrap thesethings into a transaction such that if any one of the following fails, thedatabase "creation" is rolledback. Otherwise, I would try deleting on errordetection, but it could get messy.IF @Error = 0BEGINSET @ExecString = 'CREATE DATABASE ' + @FullNameEXEC sp_executesql @ExecStringSET @Error = @@ErrorENDIF @Error = 0BEGINSET @ExecString = 'CREATE TABLE ' + @FullName + '.[dbo].[Image] ( [ID][int] IDENTITY (1, 1) NOT NULL, [Blob] [image] NULL , [DateAdded] [datetime]NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]'EXEC sp_executesql @ExecStringSET @Error = @@ErrorENDIF @Error = 0BEGINSET @ExecString = 'ALTER TABLE ' + @FullName + '.[dbo].[Image] WITHNOCHECK ADD CONSTRAINT [PK_Image] PRIMARY KEY CLUSTERED ( [ID] ) ON[PRIMARY]'EXEC sp_executesql @ExecStringSET @Error = @@ErrorEND

View 2 Replies View Related

Create Script To Create/Refresh Identical Database

Mar 26, 2008



I'm new to using SSIS and have been reading and learning slowly how to use it. I'm trying to create an identical copy of our database for reporting. I've used the Import/Export wizard, but have had some issues with foreign keys and with sql_variant columns.

I've tried searching for anything but haven't had any luck as of yet. I guess I don't even know where to start or what to look for.

Any help would be appreciated. Thanks!

View 9 Replies View Related

Grant CREATE VIEW, CREATE PROCEDURE ...

Apr 12, 2006

Hi,

I have currently a problem with setting up the permissions for some developers. My configuration looks like this.

DB A is the productive database.

DB B is a kind of "development" database.

Now we have a couple of users call them BOB, DAVID, ...

who are members of the db role db_reader and db_writer for the productive db a but they should be allowed to do nearly everything on db b.

Therefor I added them to the db role db_owner for db b.

For testing purposes I tried to "CREATE" a view TEST as BOB in database B but I received the error message

'Msg 262, Level 14, State 1, Procedure Test, Line 3

CREATE VIEW permission denied in database 'b'.'

I cross checked the permissions on db level and I even granted all available permissions on db level but nevertheless I receive this error message.

What's my mistake?

Of course it worked fine when I give them sysadmin rights but then they have far too much permissions.

Regards,

Stefan

View 8 Replies View Related

Create INDEX Within CREATE TABLE DDL

Jan 27, 2006

Hi Minor and inconsequential but sometimes you just gotta know: Is it possible to define a non-primary key index within a Create Table statement? I can create a constraint and a PK. I can create the table and then add the index. I just wondered if you can do it in one statement. e.g. I have: CREATE TABLE MyT (MyT_ID INT Identity(1, 1) CONSTRAINT MyT_PK PRIMARY KEY Clustered, MyT_Desc Char(40) NOT NULL CONSTRAINT MyT_idx1 UNIQUE NONCLUSTERED ON [DEFAULT])which creates a table with a PK and unique constraint. I would like (pseudo SQL):CREATE TABLE MyT (MyT_ID INT Identity(1, 1) CONSTRAINT MyT_PK PRIMARY KEY Clustered, MyT_Desc Char(40) NOT NULL CONSTRAINT MyT_idx1 UNIQUE INDEX NONCLUSTERED ON [DEFAULT]) No big deal - just curious :D Once I know I can stop scouring BOL for clues. Tks in advance

View 2 Replies View Related

Sql Agent

Sep 9, 2004

hi.I have a sql2000 database.I have orders in a table with orderdate and ordertime.I want to force database to delete any order if person didnt pay for it after 3 days.I think I can check that with sqlAgent.but I dont know how.I checked most sites but couldnt find any sources.any help would be appreciated.

View 11 Replies View Related

SQL Agent Will Not Run

Jan 30, 2004

I am running SQL 2000 with SP3a and Windows Server 2003 successfully. I have a associate that is attempting to set up the same configuration. Our settings match identically, but his SQL agent will not start. I have checked everything I can think of but it still will not start on his network, yet works perfectly fine on mine. The error he is getting is that the SA account failed to log in properly, yet the password is correct. Any suggestions?

View 3 Replies View Related

Sql Agent Job

Jul 13, 2007

hi iam new to SSIS. I have two packages which are almost identical, only difference is the table name in the query to extract data just a test package.the package is created under my windows account, with the default protection level. I have scheduled them using SQL server agent. one runs succesfully and the other fails with error

Message
Executed as user: NAdbasvc-alticor. ... 9.00.3042.00 for 32-bit Copyright (C) Microsoft Corp 1984-2005. All rights reserved. Started: 11:28:25 AM Error: 2007-07-10 11:28:26.21 Code: 0xC020838F Source: Staging LKPDataReader Source [1] Description: An error occurred executing the provided SQL command. End Error Error: 2007-07-10 11:28:26.21 Code: 0xC004706B Source: Staging DTS.Pipeline Description: "component "LKPDataReader Source" (1)" failed validation and returned validation status "VS_ISBROKEN". End Error Error: 2007-07-10 11:28:26.21 Code: 0xC004700C Source: Staging DTS.Pipeline Description: One or more component failed validation. End Error Error: 2007-07-10 11:28:26.21 Code: 0xC0024107 Source: Staging Description: There were errors during task validation. End Error DTExec: The package execution returned DTSER_FAILURE (1). Started: 11:28:25 AM Finished: 11:28:26 AM Elapsed: 0.906 seconds. The package execution fai... The step failed.

I understand that it is something to do with
1.protection level
2.the user account under which the package is running
3.the SQL agent account used to run job

can someone be a detailed in explaining how to get this running and one big ? is why one package fails while the other with exactly same settings is running perfectly.

Please help i bid a lot of google on this but still confusing

View 1 Replies View Related

Sql Agent Job

Jul 13, 2007

Hi, I am new to SSIS. I createdtwo packages which are almost identical, only difference is the table name in the query to extract data just a test package.the package is created under my windows account, with the default protection level. I have scheduled them using SQL server agent. one runs succesfully and the other fails with error

Message
Executed as user: NAdbasvc-alticor. ... 9.00.3042.00 for 32-bit Copyright (C) Microsoft Corp 1984-2005. All rights reserved. Started: 11:28:25 AM Error: 2007-07-10 11:28:26.21 Code: 0xC020838F Source: Staging LKPDataReader Source [1] Description: An error occurred executing the provided SQL command. End Error Error: 2007-07-10 11:28:26.21 Code: 0xC004706B Source: Staging DTS.Pipeline Description: "component "LKPDataReader Source" (1)" failed validation and returned validation status "VS_ISBROKEN". End Error Error: 2007-07-10 11:28:26.21 Code: 0xC004700C Source: Staging DTS.Pipeline Description: One or more component failed validation. End Error Error: 2007-07-10 11:28:26.21 Code: 0xC0024107 Source: Staging Description: There were errors during task validation. End Error DTExec: The package execution returned DTSER_FAILURE (1). Started: 11:28:25 AM Finished: 11:28:26 AM Elapsed: 0.906 seconds. The package execution fai... The step failed.

I understand that it is something to do with
1.protection level
2.the user account under which the package is running
3.the SQL agent account used to run job

can someone be a detailed in explaining how to get this running and one big ? is why one package fails while the other with exactly same settings is running perfectly.

Please help i bid a lot of google on this but still confusing

View 3 Replies View Related

SQL Agent Down

Dec 14, 2007

I got a foglight alert that sql agent is down on one sql 2000 server
But now sql services are up and running fine.
How do i investigate that why sql agent was down
Please advice?

View 5 Replies View Related

DTS And SQL Job Agent

Jan 31, 2008

I have successfully created a DTS package, and would like to use SQL Server Job Agent to schedule it (instead of right-clicking on the package and scheduling a plan because the dates that I need to run this package are not fixed). How would I proceed? I am using SQL Server 2000.

Thanks...

View 2 Replies View Related

Need Help On Job Agent

Mar 15, 2008


A scheduled job use a SELECT query to check a record in a table,
the query returns 1 or 0.
how to let the job agent know if the return values is 1 then go next step and stop checking,
if return values is 0 then keep try for every 30 minutes for 10 times.

thanks

View 1 Replies View Related

Sql Agent

Aug 17, 2006

Hi all,



I am using SQL Server Express with Advanced features. I used to use the SQL agent in SQL Server 2000 to run a stored procedure that populated a table in my database each night.



I cant seem to do this with SQL Server Express. Is there another way to run this stored procedure each night and populate the table with the data returned.

I read about using Scheduled Tasks in Windows but Im not really familar with this.



Would really appreciate any ideas.



Thanks,
Cathie

View 4 Replies View Related

Need Help On Job Agent

Mar 15, 2008

A scheduled job use a SELECT query to check a record in a table,
the query returns 1 or 0.
how to let the job agent know if the return values is 1 then go next step and stop checking,
if return values is 0 then keep try for every 30 minutes for 10 times.

thanks

View 10 Replies View Related

SQL Agent

Dec 15, 2007

I got a foglight alert that sql agent is down on one sql 2000 server
But now sql services are up and running fine.
How do i investigate that why sql agent was down
Please advice?

View 8 Replies View Related

Convert Mysql Create Script To SQL Server Create Script

Mar 29, 2008

Hi guys

Just a quick one. I have some create scripts that were created for mysql and i am wanting to convert them to a

SQL Server create script. I am just wondering if anyone knows of any utilities or codeplex projects, etc that can perform the convert process.



The script is fairly basic but it is not fully compatible but i have a lot of them thus why i want to automate the process. The majority of the script is just table create statements like the following:





Code Snippet
-- -----------------------------------------------------
-- Table `dbo`.`Staff`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `dbo`.`Staff` (
`StaffId` INT NOT NULL AUTO_INCREMENT ,
`IndividualId` INT NOT NULL DEFAULT 0 ,
`PositionId` INT NOT NULL DEFAULT 0 ,
`EmploymentStartDate` DATETIME NULL ,
`EmploymentEndDate` DATETIME NULL ,
`SupervisorStaffId` INT NULL ,
`TerminatedEmploymentReasonId` INT NULL ,
`DeletedFl` BIT NOT NULL ,
`CreateDateTime` DATETIME NOT NULL ,
`CreateUserId` INT NOT NULL ,
`ChangeUserId` INT NOT NULL ,
`ChangeDateTime` DATETIME NOT NULL ,
`VersionNum` INT NOT NULL ,
PRIMARY KEY (`StaffId`) ,
INDEX Individual_Staff_IndividualId_Ref (`IndividualId` ASC) ,
INDEX Lookup_Staff_PositionId (`PositionId` ASC) ,
INDEX Staff_Staff_SupervisorStaffId_Ref (`SupervisorStaffId` ASC) ,
INDEX Lookup_Staff_TerminatedEmploymentReasonId (`TerminatedEmploymentReasonId` ASC) ,
CONSTRAINT `Individual_Staff_IndividualId_Ref`
FOREIGN KEY (`IndividualId` )
REFERENCES `dbo`.`Individual` (`IndividualId` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `Lookup_Staff_PositionId`
FOREIGN KEY (`PositionId` )
REFERENCES `dbo`.`Lookup` (`LookupId` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `Staff_Staff_SupervisorStaffId_Ref`
FOREIGN KEY (`SupervisorStaffId` )
REFERENCES `dbo`.`Staff` (`StaffId` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `Lookup_Staff_TerminatedEmploymentReasonId`
FOREIGN KEY (`TerminatedEmploymentReasonId` )
REFERENCES `dbo`.`Lookup` (`LookupId` )
ON DELETE NO ACTION
ON UPDATE NO ACTION);







Thanks for the help

Anthony



Note: i know if you have a mysql database you can go from one to the other, but i specifically need to take these mysql create scripts and convert them to sql server create scripts and there are a LOT of them i.e. more than 1000 script files that each contains a couple of hundred table create statements.

View 4 Replies View Related

Is The Operation CREATE MINING STRUCTURE And CREATE MINING MODEL Really Useful?

Aug 17, 2006

Hi,

I've tried those two operations in the Management Studio.
Though we can create a mining structure and mining model in Management Studion,
but we cannot process the analysis-service database.

(1) I create only a mining structure through CREATE MINING STRUCTURE.
No error reported. But if I process the analysis-service database in Management Studio I always get error

'Error : The '<mining_structure__name>' structure does not contain bindings to data
(or contain bindings that are not valid) and cannot be processed.

I then tried to create it by creating and running an XMLA script. It was successful.
However, it's much harder to learn XMLA.

If any of you created an analysis-service database in Mgt Studio, and create a mining
structure in the same place using DMX script, can you process the database?

(2) Is there any use of CREATE MINING STRUCTURE operation without binding
to any table? Examples I saw so far did not show relating it to do. In my experience
processing the analysis-service database with that mining structure is doomed to fail.

(3) Is there any way we can create mining structure through CREATE MINING

STRUCTURE operation in Management Studio and use RELATED TO clause

to bind it to any Relationship to an attribute column (mandatory only if it applies), indicated by
the RELATED TO clause

(4) If this is the fact, is there any use of CREATE MINING STRUCTURE operation?
If we use BI Dev Studio, it's much easier to use the wizard.

(5) I found I cannot create a mining model inside a mining structure through operation
CREATE MINING MODEL. If you call that operation, you end up having a mining
model and a mining structure with the same name. I found that in order to create a
mining model inside a mining structure you have to call operation ALTER MINING
STRUCTURE ADD MINING MODEL. Is it true this is the only way?

Thank you,

Bernaridho

View 3 Replies View Related

What To Do If Do Not Have Sql Server Job Agent?

Dec 18, 2006

Hello everyone !!!
I need to do a process that run every day to update some data, but my sql server version (express 2005) does not have job agent service.  Does anyone can give me a suggestion of what to do?
 Thank you!
 

View 2 Replies View Related

SQL Server Agent

Mar 14, 2006

Hi there,
was wondering if any can tell me why the following jobs keeps failing:
     INSERT INTO TblActivityBookingArchive     SELECT     *     FROM         TblActivityBooking     WHERE     (expiryDate <= GETDATE())
it retuens that it is successful when there is no data to archive from TblActivityBooking, it's when there is data to archive that it returns that the job has failed.
Hope you can help
Thanks
Mel

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved