add batch remove batch split batch comment selection show hidden batches hide batch highlight batch
db<>fiddle
donate feedback about
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
DECLARE @x nvarchar(max) = N'x', @sql nvarchar(max);
SELECT @x = REPLICATE(@x, 985);

SET @sql = N'CREATE PROCEDURE dbo.foo
AS
SELECT x = N''$x$x$x$xhi this is what I am looking for'';';

SET @sql = REPLACE(@sql, N'$x', @x);

EXEC sys.sp_executesql @sql;

SET @sql = N'CREATE PROCEDURE dbo.bar
AS
SELECT x = N''$xhi this is what I am looking for$x$x$x'';';

SET @sql = REPLACE(@sql, N'$x', @x);

EXEC sys.sp_executesql @sql;


SELECT
name = object_name(id),
len_this_row = len(text),
len_whole_procedure = len(object_definition(id)),
text
FROM sys.syscomments
WHERE text LIKE N'%this is what I am looking for%';
name len_this_row len_whole_procedure text
bar 4000 4017 CREATE PROCEDURE dbo.bar
AS
  SELECT x = N'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx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