SQL syntax highlighting
For example, I have SQL statement:
insert into Table(id, name) values (1, 'x');
When I'm cursor/mouse-over a column name (like id
), then I'd like to have its corresponding value 1
highlighted.
开发者_开发知识库Is there a tool or plugin for this?
I don't want to write a tool for it, but use an existing one if one exists.
EDIT: I added eclipse and visual-studio tags, because I use both of them and maybe there is some plugin.
I do not know of a tool that does that. For your simple example I doubt you really even need that. However, you really need it when you have many columns (which I guess is the real reason for the question), and this is how I handle it:
--format your large insert statements like this
insert YourTableName
(col1 , col2 , col3 , col4 , col5
,col6 , col7 , col8 , col9 , col10
,col11 , col12 , col13 , col14 , col15
,col16 , col17)
VALUES
(1 , '2' , 3.0 , 4 , 'five'
,6 , 'seven' , 8 , @nine , 'ten'
,11.0 , 'twelve' , 13 , @_14 , 15
,'sixteen' , 17)
you can better match the values to the columns than the same insert with minimal formatting:
insert YourTableName (col1,col2,col3,col4,col5,col6,col7,col8,col9,col10,col11,col12, col13,col14, col15,col16,col17) VALUES (1, '2',3.0,4,'five',6,'seven',8,@nine, 'ten',11.0,'twelve',13,@_14,15,'sixteen',17)
This formatting is only worth it for production code, not throway one off inserts.
I have a simple stored procedures that outputs the columns of a given table. Run in text mode, I can take that output, with SSMS's ability to cut/paste rectagle selections and can quickly fromat the column list section. I duplicate that in the values list and over type the column names with the values. This works well when the values are from a select query as well.
精彩评论