存储过程转sql语句,方便测试代码,改完代码可一键逆转,转sql过程中,无需改动存储过程,方便开发,以及方便定位代码调试定位。 特别适用于无法进行远程断点调试的朋友们.. 英文文档 如果想在任意软件上使用转换功能,可以下载网盘中的软件,网盘中的软件还支持版本管理,支持一键下载数据源,和本地搜索表,存储过程,以及支持t-sql转换为sql字符串 https://drive.google.com/drive/folders/1_CB8gOL83MpJiyxfugClP6rHi7O_nyod?usp=sharing 新版本更新持续更新地址 https://t.me/qssq666
extension.sqltool.convertSql.enable
: Enable/disable this extension.extension.sqltool.convertSql
: To Convert Or select the right-click menu Stored Procedure To SQL in the Code Editor
在任意文本编辑框中右键菜单 即可 or ctrl+shift+p key keyboard stored
需要尽可能格式化成比较兼容的存储过程
SUPPORT FIX (15,3)
CREATE proc [dbo].[A]
(
@xx varchar(20),
@x decimal(15,3),
@size int
)
fix one line (arg)
ALTER PROCEDURE [dbo].[XX]
( @A int, @sSide varchar(2), @B varchar(20), @C int, @e DECIMAL(36,5), @CODE int , @MSG varchar(800) out)
AS
return 0;
GO
)
CREATE PROCEDURE [dbo].[XX]
(
@A int, @sSide varchar(2), @B varchar(20), @C int, @e DECIMAL(36,5), @CODE int , @MSG varchar(800) out
)
AS
return 0;
GO
)
This type of layout is most compatible
CREATE PROCEDURE [dbo].[XX]
(
@A int,
@sSide varchar(2),
@B varchar(20),
@C int,
@e DECIMAL(36,5),
@CODE int ,
@MSG varchar(800) out
)
AS
return 0;
GO
)
or
CREATE PROCEDURE [dbo].[XX]
@A int,
@sSide varchar(2),
@B varchar(20),
@C int,
@e DECIMAL(36,5),
@CODE int ,
@MSG varchar(800) out
AS
return 0;
GO
)
CREATE
keyword at new line
param at new line
and AS
keyword at new Line
So the most perfect
CREATE PROCEDURE [dbo].[XX]
(
@A int, @sSide varchar(2), @B varchar(20), @C int, @e DECIMAL(36,5), @CODE int , @MSG varchar(800) out
)
AS
return 0;
GO
)
ALTER PROCEDURE [dbo].[XX]
( @A int, @sSide varchar(2), @B varchar(20), @C int, @e DECIMAL(36,5), @CODE int , @MSG varchar(800) out)
AS
return 0;
GO
src code
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[XX]
( @A int, @sSide varchar(2), @B varchar(20), @C int, @e DECIMAL(36,5), @CODE int , @MSG varchar(800) out)
AS
return 0;
GO
after -->
SET ANSI_NULLS ON--CONVERT_SUCCESS,Date:2024-04-09T09:40:14.270Z
GO
SET QUOTED_IDENTIFIER ON
GO
-- ALTER PROCEDURE [dbo].[XX]
--X (
declare @A int;
declare @sSide varchar(2);
declare @B varchar(20);
declare @C int;
declare @e DECIMAL(36,5);
declare @CODE int ;
declare @MSG varchar(800) --out;
--X )
--X
--X
-- set @A='';--[TEMP]0[ARG]
-- set @sSide='';--[TEMP]1[ARG]
-- set @B='';--[TEMP]2[ARG]
-- set @C='';--[TEMP]3[ARG]
-- set @e='';--[TEMP]4[ARG]
-- set @CODE='0';--[TEMP]5[ARG]
-- set @MSG='';--[TEMP]6[ARG]
-- AS
select 16 as N'responseLine',7 as N'argCount',@A as N'@A',@sSide as N'@sSide',@B as N'@B',@C as N'@C',@e as N'@e',@CODE as N'@CODE',@MSG as N'@MSG';return;-- return 0;
GO
## nor not recommend
ALTER PROCEDURE [dbo].[XX]
( @A int, @sSide varchar(2),
@B varchar(20), @C int, @e DECIMAL(36,5), @MSG varchar(800) out)
BEGIN
END
您将收到以下错误 错误内容为:失败!请格式化存储过程,确保存储过程参数的双括号在同一行上,或者双括号在单独的行上,不能与参数在同一行上
由于识别语法的机制相对简单,它涉及从上到下的线性扫描,这增加了编码的复杂性。我不打算与这种写作方法兼容。
Because the mechanism for recognizing syntax is relatively simple, it involves linear scanning from top to bottom, which increases the complexity of encoding. I do not intend to be compatible with this writing method.
由于注释介于 insert 和 select 之间,因此处理这种情况可能非常麻烦,而我这个转换的实现原理并没有用到任何语法引擎,而是单纯的线性扫描标记。
insert into dbo.sysmergearticles (name, type, objid, sync_objid, artid)
-- use top 1, distinct could return more than one matching row if status different on partitioned articles
select top 1 @article, type, objid, @sync_objid
from dbo.sysmergearticles where artid = @artid
以下代码在单个参数行上定义多个注释,这是不受支持的 多行参数,有的每行有2个参数,有的只有一个。目前,每行仅支持一个参数,或者所有参数都在同一行上
ALTER procedure [sys].[sp_addmergearticle]
@publication sysname, /* publication name */ @article sysname, /* article name */
@source_object sysname, /* source object name */
@type sysname = 'table', /* article type
AS
*/
select @a,@b,@c,@d,@e
选中这些文本右键菜单 @a,@b,@c,@d,@e
选择 Multi Sql param to print str
将快速转换为如下代码
print('@:'+cast(isnull(@,'NULL') as varchar(100))+',''@:'+cast(isnull(@,'NULL') as varchar(100))+',''@:'+cast(isnull(@,'NULL') as varchar(100))+',''@:'+cast(isnull(@,'NULL') as varchar(100))+',''@e:'+cast(isnull(@e,'NULL') as varchar(100)))
- 35697438@qq.com telegram : https://t.me/lozn00 Enjoy!
支持更多sql语言 ,完善兼容性