Methods to reference fields

Hello

Can you tell me please:

How can I reference fields especially when I don't know them or they are too many? I mean, we can use SELECT * for all fields but how can I use that for CONCAT(*)? Also how can I use wildcards for fields i.e. [Product%]?

Thanks!

You have asked this same question in a variety of ways dozens of time. Many have answered these questions. You have not responded to them wether they worked or not. Please go back to the previous questions and answers and respond to those?

@yosiasz yes and thanks, I remember using sys.objects or information_schema but I am actually looking for something neater as it ends up writing quite many lines for something seemingly simple!

there is no such way other than using sys.* or INFORMATION_SCHEMA

1 Like

You can't use wildcards for columns - it seems you want to find some way to shortcut the actual writing of the code.

In SSMS - from the object explorer you can drag the columns into your query. If you want all columns then drag the 'folder' column for that table.

A better option would be to purchase an intellisense tool that can do this for you. There are some free ones that may have that capability, but you would have to search for them. I am not aware of any myself.

Now - with that said, Redgate's SQL Prompt does what you want. Type your query out as: SELECT * FROM sometable and then move your cursor to the * - then hit TAB and SQL Prompt will input all columns from the query. That works also with CONCAT or CONCAT_WS.

2 Likes

op seems to be trying to do some sort of data forensics to find a value in any column.
But op hasnt stated what they want

2 Likes