I have a sp tried to code something like below
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[ABC]
@Food_Pickup VARCHAR(10),
@Food_Dropoff VARCHAR(10),
AS
BEGIN
SET NOCOUNT ON;
INSERT INTO [dbo].[DEF] (QUOTE, COMPANY_CODE, BAID, EID)
VALUES
(@Food_Pickup,'B','A','3#') ,
(IF len(@Food_Dropoff) > 3 SUBSTRING(@Food_Dropoff,1, 3),'C', 'k', (Row INT IDENTITY(1, 1)) CONCAT('...',SUBSTRING(@Food_Dropoff,4, len(@Food_Dropoff))),'C', 'k', )
ELSE
(@Food_Dropoff,'C', 'k' ,)
END
GO
So, My requirement is, if i exec sp and input the Food_dropoff as 'Atlanta' , if the input exceeds a certain length in this case 3, then it should go next line
Exec [dbo].[ABC] 'Alabama' 'Atlanta'
Then the output should be like this
Quote COMPANY_CODE BAID EID
1 Alabama B A 3#
2 Atl C k
3 ...anta C k