J'ai une requête SQL que j'ai besoin de lancer sur plusieurs instances via une requête.Requête Sqlcmd dans la base de données mulliple "Argument inattendu"
Use Extracts
DECLARE @RunDate DATETIME;
DECLARE @WeeklyRunDate DATETIME;
SET @RunDate = '2016/08/31'
SET @WeeklyRunDate = (select DATEADD(dd, -(DATEPART(dw, @RunDate)-1), @RunDate))
Update Extracts..Processlastruns
Set Proclastrunsystemdate [email protected] , proclastwritesystemdate [email protected]
Where Procrunid in(select Procrunid From Extracts..Processruns Where Procrunenabled ='1' and Procrunfreqdaycount ='7')
Update Extracts..Processlastruns
Set Proclastrunsystemdate [email protected] , proclastwritesystemdate [email protected]
Where Procrunid in(select Procrunid From Extracts..Processruns Where Procrunenabled ='1' and Procrunfreqdaycount ='1')
J'utilise cette requête, mais cela ne fonctionne pas. J'attrapant "argument inattendu"
sqlcmd -S 192.168.0.1 -U sa -P test1234
"Use Extracts DECLARE @RunDate DATETIME; DECLARE @WeeklyRunDate DATETIME; SET @RunDate = '2016/08/31' SET @WeeklyRunDate = (select DATEADD(dd, -(DATEPART(dw, @RunDate)-1), @RunDate)) Update Extracts..Processlastruns Set Proclastrunsystemdate [email protected] , proclastwritesystemdate [email protected] Where Procrunid in(select Procrunid From Extracts..Processruns Where Procrunenabled ='1' and Procrunfreqdaycount ='7') Update Extracts..Processlastruns Set Proclastrunsystemdate [email protected] proclastwritesystemdate [email protected] Where Procrunid in(select Procrunid From Extracts..Processruns Where Procrunenabled ='1' and Procrunfreqdaycount ='1')" -o extract.csv -s"," -w 700
Merci! Problème résolu. – Raven
@Raven Pouvez-vous le marquer comme réponse? THX – Prisoner