37 lines
1.1 KiB
Transact-SQL
37 lines
1.1 KiB
Transact-SQL
/****** MoonPro_IOB-ISF_PAMA Script Date: 13/03/2023 19:03:53 ******/
|
|
|
|
-- creazione sinonimi
|
|
CREATE SYNONYM [dbo].[syn_ERP2M] FOR [P_HUB_PLD392].[dbo].[ERP2M]
|
|
CREATE SYNONYM [dbo].[syn_M2ERP_MACHINE_STATE] FOR [P_HUB_PLD392].[dbo].[M2ERP_MACHINE_STATE]
|
|
CREATE SYNONYM [dbo].[syn_M2ERP_PRODORDERS] FOR [P_HUB_PLD392].[dbo].[M2ERP_PRODORDERS]
|
|
|
|
GO
|
|
|
|
-- fix funzione
|
|
/***************************************
|
|
* FUNCTION f_padLeft
|
|
*
|
|
* fornisce una stringa della lunghezza desiderata aggiungendo a sx il carattere richiesto alla @string originale
|
|
*
|
|
* Steamware, S.E.L.
|
|
* mod: 2010.03.19
|
|
*
|
|
****************************************/
|
|
create FUNCTION [dbo].[f_padLeft] (@string VARCHAR(255), @desired_length INTEGER, @pad_character CHAR(1))
|
|
RETURNS VARCHAR(255) AS
|
|
BEGIN
|
|
|
|
-- Prefix the required number of spaces to bulk up the string and then replace the spaces with the desired character
|
|
RETURN CASE
|
|
WHEN LEN(@string) < @desired_length
|
|
THEN REPLACE(SPACE(@desired_length - LEN(@string)), ' ', @pad_character) + @string
|
|
ELSE @string
|
|
END
|
|
|
|
END
|
|
GO
|
|
|
|
|
|
|
|
-- fix stored specifiche
|