November 12, 2008 at 7:05 am
I am trying to insert the resulst from the following script into a table called License_Audit. Not sure how to go about it. Any help will be greatly appreciated.
SELECT = COUNT(USER_ID) AS LICENSE_COUNT
FROM VMFG.dbo.LOGINS
WHERE PROGRAM_ID = 'MENU'
November 12, 2008 at 7:08 am
if the table already exists:
INSERT INTO License_Audit(LicenseType,LICENSECOUNT,AUDITDATE)
SELECT 'MENU',COUNT(USER_ID) AS LICENSE_COUNT ,getdate()
FROM VMFG.dbo.LOGINS
WHERE PROGRAM_ID = 'MENU'
to create the table on the fly:
SELECT 'MENU' AS LicenseType,COUNT(USER_ID) AS LICENSE_COUNT ,getdate() AS AUDITDATE
INTO License_Audit
FROM VMFG.dbo.LOGINS
WHERE PROGRAM_ID = 'MENU'
Lowell
November 12, 2008 at 7:38 am
The script worked great. I tried setting up a job to run this script, but it fails each time. Do I need to change something in the script in order for it to execute successfully in job mode?
INSERT INTO License_Audit(LicenseType,LICENSE_COUNT,AUDITDATE)
SELECT 'MENU',COUNT(USER_ID) AS LICENSE_COUNT ,getdate()
FROM VMFG.dbo.LOGINS
WHERE PROGRAM_ID = 'MENU'
November 12, 2008 at 8:06 am
I figured it out. Thanks for all the help. It is greatly appreciated.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply