SQL syntax highlighting

For example, I have an SQL statement:

insert into Table(id, name) values (1, 'x'); 

When I cursor / mouse over a column name (e.g. id ), then I would like to highlight its corresponding value 1 .

Is there a tool or plugin for this?

I do not want to write a tool for it, but use an existing one if it exists.

EDIT: I added the eclipse and visual-studio tags because I use both of them and there may be a plugin.

+4
source share
1 answer

I do not know the tool that does this. For your simple example, I doubt that you really need it. However, you really need this when you have many columns (which, I think, is the real cause of the question), and here 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 values ​​with columns than the same inserts 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 for production code, not for inserting a single insert.

I have simple stored procedures that output the columns of a given table. Running in text mode, I can take this output, with SSMS the ability to cut / paste the selection of the rectangle and can quickly from the column list section. I repeat that in the list of values ​​and above, enter the column names with the values. This works well when the values ​​also apply to the selected query.

+3
source

Source: https://habr.com/ru/post/1341998/


All Articles