SQL Query构建与调用存储过程和使用固定值

时间:2017-03-31 13:17:57

标签: sql stored-procedures export

我试图从一个地方开始出口到另一个地方。

我试图建立的这个查询需要确保在选择搜索记录后自动导出,而不是在客户端(gui)手动搜索每个导出并右键单击导出到。< / p>

我输入的字符串是固定的,select是来自数据库。

存储过程称为CreateExportWorkItem

SELECT 
    'exec '+ 'http://' +  picHost + '/' + picUrl as piclocation, stat.number, stat.humid, stat.picDateTime as datetime
FROM
    defaultclinical.dbo.vwSwpicLocation as loc
JOIN
    defaultstatistics.dbo.receivedpics as stat ON stat.picuid = loc.picuid
WHERE 
    loc.picUid IN (SELECT picUID 
                   FROM defaultStatistics.dbo.ReceivedPics
                   WHERE OrganizationId IN ('SVH', 'RES')
                     AND ReceivedDateTime BETWEEN '2017-03-20 19:28:14.845' AND '2017-03-23 03:56:23.620')
                     AND picHost like 'server12%',

@CreatedUserName='administrator',
@remoteIpAddress='192.168.15.20',
@remotePort='80',
@remoteNumberOfConcurrentRequests='2',
@remoteResendpicOnRetry='0',
@remoteKeepConnectionAcrosspics='0',
@remoteBsnExport='0',
@MaxRetries='1',
@RetryDelay='10',
@Priority='0',
@locationAffinity='Main Location'

感谢您的帮助。

0 个答案:

没有答案