Timeline for is there a "Wildcard Except" function in MSSQL? [duplicate]
Current License: CC BY-SA 4.0
11 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Oct 7, 2019 at 8:06 | comment | added | Geoff Griswald | Thanks Larnu for the "SQL Prompt" tip. Some of my tables have 300-400 columns and listing out every one for a simple INSERT INTO is a massive pain. | |
Oct 4, 2019 at 13:45 | review | Reopen votes | |||
Oct 9, 2019 at 13:30 | |||||
Oct 4, 2019 at 13:28 | history | edited | Geoff Griswald | CC BY-SA 4.0 |
deleted 55 characters in body
|
Oct 4, 2019 at 13:27 | history | duplicates list edited | user330315 | duplicates list edited from SELECT * EXCEPT, Exclude a column using SELECT * [except columnA] FROM tableA? to SELECT * EXCEPT, Exclude a column using SELECT * [except columnA] FROM tableA?, Can you SELECT everything, but 1 or 2 fields, without writer's cramp? | |
Oct 4, 2019 at 13:26 | comment | added | Martin |
This sounds like an interesting addition to the SQL syntax but it's always better to be explicit in what you are returning as opposed to implicit. Imaging expecting a result set containing 10 columns (which the id column was excluded from) and then months later someone added 5 more columns to the table. Is your code robust enough to deal with the unexpected columns? Would anyone else's code that consume's the result set be?
|
|
Oct 4, 2019 at 13:26 | comment | added | Thom A |
Blargh on that WHILE solution on the duplicate.
|
|
Oct 4, 2019 at 13:25 | history | duplicates list edited | user330315 | duplicates list edited from SELECT * EXCEPT to SELECT * EXCEPT, Exclude a column using SELECT * [except columnA] FROM tableA? | |
Oct 4, 2019 at 13:25 | history | closed | user330315 | Duplicate of SELECT * EXCEPT | |
Oct 4, 2019 at 13:23 | comment | added | DavidG |
No, you need to manually choose your columns, and quite frankly you should do that. SELECT * in any format is bad practice.
|
|
Oct 4, 2019 at 13:23 | comment | added | Thom A |
No. You need to list your columns out, and remove the one you don't want. If you really don't want to write them all out, purchase a add-on tool that allows the * character to be expanded by a hot key (for example, I use SQL Prompt, and you can Tab the * to have to changed to the name of every column with their relevant object prefix (alias)), and then remove the "offending" column.
|
|
Oct 4, 2019 at 13:22 | history | asked | Geoff Griswald | CC BY-SA 4.0 |