Month: December 2012

SQL – Getting list of jobs and their steps

How to get list of jobs an their steps. For this I will use three tables dbo.sysjobs, dbo.sysjobsteps and dbo.sysjobschedules in msdb database. You can create select from each of these tables to get relevant data. select name,enabled,description from msdb.dbo.sysjobs select job_id,step_id,step_name,command,database_name from msdb.dbo.sysjobsteps select job_id,next_run_date,next_run_time from msdb.dbo.sysjobschedules   But we can combine these three …


SQL- Creating linked server to AS400

Have you ever tried to connect to AS400. It’s been a hassle for me. But finally I got it to work, so let me share little of my wisdom with you. First create linked server, then change options to it. EXEC master.dbo.sp_addlinkedserver @server = N’AS400′, @srvproduct=N’i520′, @provider=N’IBMDA400′, @datasrc=N’AS400′, @provstr=N’User Id=USER;Password=PWD;Default Collection=DAT;’ Change option: USE [master] …


SQL – Table comparison