{"id":6173,"date":"2018-01-19T14:35:27","date_gmt":"2018-01-19T13:35:27","guid":{"rendered":"http:\/\/help.sdna.lu\/?p=6173&#038;lang=en"},"modified":"2022-12-18T11:14:18","modified_gmt":"2022-12-18T10:14:18","slug":"query-to-mass-create-job-numbers","status":"publish","type":"post","link":"https:\/\/sdna.lu\/?p=6173","title":{"rendered":"Query to mass create job numbers"},"content":{"rendered":"<p>Use this query to mass create job numbers:<\/p>\n<p><code>Insert Into [Job] ([DBId], [Id], [Number], [ClientId], [JobTypeId], [DivisionId], [Description], [Actif], [Archive], [JobServiceTRRestriction], [StartDate], [EndDate], [Chargeable], [Status], [TRLockType], [FileHolderEmployeeId], [ReferenceYear], [SupplierBudgetAmount], [JobCategoryId], [StrategyId])<br \/>\nSelect [Client].[DBId] as [ResDBId],<br \/>\nROW_NUMBER() OVER(ORDER BY [Client].[Id] ASC) + 13858 AS [ResId],<br \/>\nleft(case when [Company].[Name] Is Null then [Person].[Name] else [Company].[Name] end,61) + ' - Liquidation' as [ResNumber],<br \/>\n[Client].[Id] as [ResClientId],<br \/>\n0 as [ResJobTypeId],<br \/>\n0 as [ResDivisionId],<br \/>\n'' as [ResDescription],<br \/>\n1 as [ResActif],<br \/>\n0 as [ResArchive],<br \/>\n1 as [JobServiceTRRestriction],<br \/>\n'30\/12\/1899' as [StartDate],<br \/>\n'30\/12\/1899' as [EndDate],<br \/>\n0 as [Chargeable],<br \/>\n0 as [Status],<br \/>\n0 as [TRLockType],<br \/>\n0 as [FileHolderEmployeeId],<br \/>\n'30\/12\/1899' as [ReferenceYear],<br \/>\n0 as [SupplierBudgetAmount],<br \/>\n0 as [JobCategoryId],<br \/>\n0 as [StrategyId]<br \/>\nfrom (([Client] LEFT JOIN [Company]<br \/>\nON ([Client].[CompanyId] = [Company].[Id] and [Client].[DBId] = [Company].[DBId]))<br \/>\nLEFT JOIN [Person]<br \/>\nON ([Client].[PersonId] = [Person].[Id] and [Client].[DBId] = [Person].[DBId]))<br \/>\nwhere [Client].[DBId] = XXX<\/code><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Use this query to mass create job numbers: Insert Into [Job] ([DBId], [Id], [Number], [ClientId], [JobTypeId], [DivisionId], [Description], [Actif], [Archive], [JobServiceTRRestriction], [StartDate], [EndDate], [Chargeable], [Status], [TRLockType], [FileHolderEmployeeId], [ReferenceYear], [SupplierBudgetAmount], [JobCategoryId], [StrategyId]) Select [Client].[DBId] as [ResDBId], ROW_NUMBER() OVER(ORDER BY [Client].[Id] ASC) + 13858 AS [ResId], left(case when [Company].[Name] Is Null then [Person].[Name] else [Company].[Name] end,61) + [&hellip;]<\/p>\n","protected":false},"author":19,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[487],"tags":[],"class_list":["post-6173","post","type-post","status-publish","format-standard","hentry","category-query"],"_links":{"self":[{"href":"https:\/\/sdna.lu\/index.php?rest_route=\/wp\/v2\/posts\/6173","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sdna.lu\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sdna.lu\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sdna.lu\/index.php?rest_route=\/wp\/v2\/users\/19"}],"replies":[{"embeddable":true,"href":"https:\/\/sdna.lu\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6173"}],"version-history":[{"count":4,"href":"https:\/\/sdna.lu\/index.php?rest_route=\/wp\/v2\/posts\/6173\/revisions"}],"predecessor-version":[{"id":6198,"href":"https:\/\/sdna.lu\/index.php?rest_route=\/wp\/v2\/posts\/6173\/revisions\/6198"}],"wp:attachment":[{"href":"https:\/\/sdna.lu\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6173"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sdna.lu\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6173"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sdna.lu\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6173"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}