January 23, 2015 at 1:52 am
I've been working with some wide and unfamiliar tables recently. Scanning and finding column names can be a challenge in these cases.
So I started thinking that a nice SSMS function would be to create a 'right-click/sort' function on the 'Columns' node β for display only.
What do others think? Or is this functionality already available somewhere?
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
January 23, 2015 at 2:02 am
That definitely sounds like a good idea. We've got some tables that are 300-ish columns wide and I'd said at least at third of those are all nulls (don't ask, we used a third party to create this mess). Having some way of easily finding the column I want would be very useful.
How to post a question to get the most help http://www.sqlservercentral.com/articles/Best+Practices/61537
January 23, 2015 at 2:34 am
This is something that I noticed some period ago, and it's definitely a good idea - a filter for the columns to be implemented in ssms.
Sometimes I use the red-gate SQL Search (free), and sometimes I use the following query.
select c.name, tp.name
from sys.tables t
join sys.columns c on t.object_id = c.object_id
join sys.types tp on c.user_type_id = tp.user_type_id
where SCHEMA_NAME(t.schema_id)='dbo' and t.name = 'Matches' and c.name like '%ID%'
order by c.name
Igor Micev,My blog: www.igormicev.com
January 23, 2015 at 7:03 am
Igor Micev (1/23/2015)
This is something that I noticed some period ago, and it's definitely a good idea - a filter for the columns to be implemented in ssms.Sometimes I use the red-gate SQL Search (free), and sometimes I use the following query.
select c.name, tp.name
from sys.tables t
join sys.columns c on t.object_id = c.object_id
join sys.types tp on c.user_type_id = tp.user_type_id
where SCHEMA_NAME(t.schema_id)='dbo' and t.name = 'Matches' and c.name like '%ID%'
order by c.name
something very similar, except I include the schema name and ignore sys tables, so that new systems I work on I can plug it in to Excel using a DB connection.
That way I keep SSMS on one screen the Column list spreadsheet on the other.
_________________________________________________________________________
SSC Guide to Posting and Best Practices
January 23, 2015 at 7:24 am
Doesn't Intellisense do what you want here? Or are you looking for the datatype and constraints, etc, as well?
--Jeff Moden
Change is inevitable... Change for the better is not.
January 23, 2015 at 7:39 am
Jeff Moden (1/23/2015)
Doesn't Intellisense do what you want here? Or are you looking for the datatype and constraints, etc, as well?
This is not about cutting code β SQL Prompt gives me all of that with no problem. It's more for answering quick questions: what's the length of the ProductName column in table X? There are other ways of getting to that, of course.
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
January 23, 2015 at 9:18 am
Ah. Understood. In that case, I just use sp_help 'schemaname.tablename' and then search the results.
--Jeff Moden
Change is inevitable... Change for the better is not.
January 23, 2015 at 9:25 am
Yeah, I'd be using sys.objects etc for that, or the INFORMATION_SCHEMA views.
Could be nice to have sorting/filtering on the Object Explorer though.
January 23, 2015 at 12:37 pm
Gazareth (1/23/2015)
Yeah, I'd be using sys.objects etc for that, or the INFORMATION_SCHEMA views.Could be nice to have sorting/filtering on the Object Explorer though.
For quickly finding objects, there already is. Right click on (for example) TABLES in any database in Object Explorer and click on "Filter".
--Jeff Moden
Change is inevitable... Change for the better is not.
January 24, 2015 at 4:45 pm
...or you can use the Object Explorer Details view to sort the columns.
Just click on the "Columns" node in Object Explorer, then press F7 to open the details view and click the header of whichever detail element you want to sort by. - e.g. Name
You can dock the details view on the side of the window if that makes life easier as well.
Of course there are also various add-ins that will display tooltips with column type/size information when you hover over them in the editor.
MM
select geometry::STGeomFromWKB(0x0106000000020000000103000000010000000B0000001000000000000840000000000000003DD8CCCCCCCCCC0840000000000000003DD8CCCCCCCCCC08408014AE47E17AFC3F040000000000104000CDCCCCCCCCEC3F9C999999999913408014AE47E17AFC3F9C99999999991340000000000000003D0000000000001440000000000000003D000000000000144000000000000000400400000000001040000000000000F03F100000000000084000000000000000401000000000000840000000000000003D0103000000010000000B000000000000000000143D000000000000003D009E99999999B93F000000000000003D009E99999999B93F8014AE47E17AFC3F400000000000F03F00CDCCCCCCCCEC3FA06666666666FE3F8014AE47E17AFC3FA06666666666FE3F000000000000003D1800000000000040000000000000003D18000000000000400000000000000040400000000000F03F000000000000F03F000000000000143D0000000000000040000000000000143D000000000000003D, 0);
January 25, 2015 at 5:30 am
mister.magoo (1/24/2015)
...or you can use the Object Explorer Details view to sort the columns.Just click on the "Columns" node in Object Explorer, then press F7 to open the details view and click the header of whichever detail element you want to sort by. - e.g. Name
You can dock the details view on the side of the window if that makes life easier as well.
Of course there are also various add-ins that will display tooltips with column type/size information when you hover over them in the editor.
Nifty! Thanks MM.
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
January 26, 2015 at 3:10 am
mister.magoo (1/24/2015)
...or you can use the Object Explorer Details view to sort the columns.Just click on the "Columns" node in Object Explorer, then press F7 to open the details view and click the header of whichever detail element you want to sort by. - e.g. Name
You can dock the details view on the side of the window if that makes life easier as well.
Of course there are also various add-ins that will display tooltips with column type/size information when you hover over them in the editor.
Nice π
January 27, 2015 at 8:22 am
I know this is fairly radical, but I enforce an alphabetic order to the column list in the schema. My only concession is pk first.
I got an incredible amount of whining, but after a while it died down as people got accustomed to the standard.
Don Simpson
January 27, 2015 at 8:34 am
DonlSimpson (1/27/2015)
I know this is fairly radical, but I enforce an alphabetic order to the column list in the schema. My only concession is pk first.I got an incredible amount of whining, but after a while it died down as people got accustomed to the standard.
Do all of your new columns begin with 'z'? π
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
January 28, 2015 at 8:13 am
mister.magoo (1/24/2015)
...or you can use the Object Explorer Details view to sort the columns.Just click on the "Columns" node in Object Explorer, then press F7 to open the details view and click the header of whichever detail element you want to sort by. - e.g. Name
You can dock the details view on the side of the window if that makes life easier as well.
Of course there are also various add-ins that will display tooltips with column type/size information when you hover over them in the editor.
Oh Magoo you've done it again. Thanks for the tip.
-------------------------------------------------------------
we travel not to escape life but for life not to escape us
Don't fear failure, fear regret.
Viewing 15 posts - 1 through 15 (of 15 total)
You must be logged in to reply to this topic. Login to reply