开发者

Is there a web site where I can paste a SQL Insert statement and have it break it out by column?

开发者 https://www.devze.com 2022-12-28 18:49 出处:网络
I\'ve been working on an application that has no discernable data access layer, so all the SQL statements are just built up as strings and executed.I\'m constantly confronted by very long INSERT state

I've been working on an application that has no discernable data access layer, so all the SQL statements are just built up as strings and executed. I'm constantly confronted by very long INSERT statements where I'm trying to figure out what value in the VALUES list matches up with what column in the column name list.

I was about to create a little helper applicat开发者_如何学运维ion where I could paste in an INSERT statement and have it show me a list of values matched up with the column names, just for debugging, and I thought, "someone else has probably done this already."

Does anyone know of a web site where I can just paste in an INSERT statement and have it show me a two column table with column names in the first column and values in the second column?


not a website but have you tried either visual studio or Sql Server Management studio. Both of these are able to do this.


You can use SQL Server Management studio or Visual Studio (with Server Explorer) to do that. For SSMS, follow these steps:

  1. On a random table, click "Edit Top 200 Rows"
  2. Open the SQL pane and paste your Insert script.
  3. Open the Criteria Pane, which displays the insert column value pairs.


http://www.dpriver.com/pp/sqlformat.htm


I use Red Gate SQL Prompt for all my re-formatting.

Even though it is unnecessary (and unused), I often use aliases to make it easier to line things up, so instead of:

INSERT INTO tbl
SELECT 2 * y
FROM other_tbl

I usually do:

INSERT INTO tbl (x)
SELECT 2 * y AS x
FROM other_tbl
0

精彩评论

暂无评论...
验证码 换一张
取 消