Learning to Search

  • Comments posted to this topic are about the item Learning to Search

  • SQL Search is a great tool and I used it quite a lot. Then I installed 2016 SSMS and that was the end of it. I'll be sure to reinstall it as soon as it gets updated to work with 2016 SSMS though!

  • Until Windows had search functionaility built into Explorer I used Visual Studio's Find in Files feature as it isn't limited to the current project or solution but can seach on any drive you have access to.

    As for emails, I use my Inbox as a traditional (read physical) Inbox. It is a todo list of tasks so everything either gets filed or deleted when either dealt with or discarded. This may seem like a bit of an overhead but it allows me to do things like catching up on SSC editorials that I have missed due to being too busy at work as the daily SSC newsletter only gets deleted once I have read that editorial, for example. I found that categorisation doesn't work well in this scenario for me.

    Search is a great feature, however, it cannot be a task manager too.

    Gaz

    -- Stop your grinnin' and drop your linen...they're everywhere!!!

  • I agree. I hardly ever use object explorer to find objects. It probably would be nice to have SQL Search, but I don't.

    Instead, years ago I built a few lean-mean procedures that I have copied to all our major databases. I can't count how many times I use these daily, because i don't have enough fingers and toes.

    FindInAllProc 'SearchText'

    -- searches SPs and functions for whatever's in the argument

    Procs 'name%here'

    -- searches for SP and function names like the argument

    -- 2nd optional argument is a bit to sort by create date descendingly

    Tbls 'name%here'

    -- searches for table and view names like the argument

    -- 2nd optional argument is a bit to sort by create date descendingly

    Cols 'name%here' -- shows all columns of like named tables

    -- 2nd optional argument will limit results to column names like the argument

    -- 3rd optional argument will limit results to column types like the argument

    -- the proc returns just column name and data type

    -- If I need more info, that's what sp_help is for (but isn't as fast)

  • SQL Search is such a huge time saver. Just yesterday I was wondering where we were referencing a linked server that we're going to migrate, then a job I couldn't remember the name of and a stored procedure I knew was one of only a couple that referenced a certain table.

    So much frustration avoided. So much time saved.

  • Gary Varga (7/27/2016)


    As for emails, I use my Inbox as a traditional (read physical) Inbox. It is a todo list of tasks so everything either gets filed or deleted when either dealt with or discarded. This may seem like a bit of an overhead but it allows me to do things like catching up on SSC editorials that I have missed due to being too busy at work as the daily SSC newsletter only gets deleted once I have read that editorial, for example. I found that categorisation doesn't work well in this scenario for me.

    I use my in box in the same way, trying to get it as small as possible as I deal with various issues. Once done though I move the email to a separate "categorized" folder.

  • I completely agree. I always have SQL Search open. I use it to get to any objects I need to in the db. Love it!

  • MS made a change in office that I have not read much about, they now have a "what do you want to do" box on the top of the ribbon. A very nice way to not have to find a command on all of the ribbons, especially if you are looking for something that is seldom used. Now they need to get that into SSMS and VS, given how many more options you have in these.

  • I have been using Google over searcing in BOL for over 5 years. I find it much faster and easier to navigate if you do not know what specifically you are searching for,

  • Regarding emails (at work), I create an annual PST file. As I get the periodic “do you want to archive” I move anything I received or sent for a particular year into that PST (as well as tasks, appointments, etc.)

    Then once in a blue moon, I’ll “clean up” the year. Sort by sender and delete emails that are obviously garbage. Then I’ll sort by size and edit or delete them based on content. WHY do people insist on a complete desktop screen capture to show me a 2 line error message produced by a small dialog box?

    After that, if I need something, I’ll find it using search from Outlook or “desktop”.

    In the past I tried to use category folders, but I spent so much time deciding what folder to put something into. If it matched multiple categories, I then had to decide which was best. I found that I would spend all that time, and then not use / care about it later.

    Beer's Law: Absolutum obsoletum
    "if it works it's out-of-date"

  • I've done a few presentations on SQL Server Full-Text search and love how teaching something really encourages you to learn more about it. During the time spent working on the presentations I learned more about how Full-Text search and the Windows search functions are interrelated with the shared iFilters. Also learned how to customize the Windows search features to have it actually index the contents of .sql script files and even .dtsx files so that I can search for any SSIS files or scripts that might reference a certain column or use a certain function.

    That being said, I do still setup filters in gmail to delete the excessive spam that comes in. No need to hold onto that junk.

  • I use Outlook at home with Google being my email provider. I have folders set up for different topics: photography, computers, etc., and there can be subfolders.

    Generally at the end of the 1st quarter of the year, I will clean up my Outlook PST file and tell it to archive everything that occurred the prior year.

  • For work, I have folders set up for each project or system and I move the emails to the relevant folders. If my manager wants to know something about the project or system, I can go to that folder and get the information for him.

  • Just yesterday, I was trying to find objects that referenced certain text. Here's an example of what I used.

    Use AdventureWorks2014;

    SELECT

    SCHEMA_NAME(O.SCHEMA_ID) As [Schema Name]

    , O.NAME As [Name]

    , O.type_desc As [Object Type]

    , OBJECT_DEFINITION(OBJECT_ID) As [Definition Text]

    FROM

    sys.SYSCOMMENTS AS C

    INNER JOIN SYS.OBJECTS AS O ON C.ID = O.[OBJECT_ID]

    INNER JOIN SYS.SCHEMAS AS S ON O.SCHEMA_ID = S.SCHEMA_ID

    WHERE

    OBJECT_DEFINITION(OBJECT_ID) LIKE '%Employee%'

    ORDER BY

    [Schema Name]

    , [Object Type]

    , [Name];Enjoy!

  • here's the syscomments search script we've used for years for exactly the same kinds of numerous consulting clients, exploratory motivation Steve had mentioned... it can be pretty neat that (business) logic in sql is inherently less opaque, in it's runtime form, and therefore generally more open to raw discovery and mild ongoing maintenance than typical compiled code base (and before you bother to write the critical response, of course there's all kinds of pros and cons to be considered to implementing one way or the other)... apologize for no comments especially since i'm not sure why certain portions were done as they are... for those unfamiliar, compiling a sproc in master makes it available no matter which user DB is your current context... as always, season to taste.

    USE [master]

    GO

    CREATE proc [dbo].[sp_ProcSearch]

    @searchText varchar(255),

    @schemaName sysname = N'dbo'

    as begin

    declare @wildcard varchar(257)

    set @wildcard = '%' +replace(@searchText, '_', '[_]')+ '%'

    declare @sql nvarchar(max)

    set @sql = N'select @schemaId = schema_id from ['+db_name()+'].sys.schemas (nolock) where name = @schemaName'

    declare @schemaId int

    exec sp_executesql @sql, N'@schemaName sysname, @schemaId varchar(10) out', @schemaName=@schemaName, @schemaId=@schemaId out

    --select @schemaId = 'and o.schema_id = ' + convert(varchar, schema_id) from sys.schemas (nolock) where name = @schemaName

    --print '@schemaId :' + @schemaId + ', @schemaName: ' + @schemaName

    declare @schemaFilter varchar(1000) = ''

    if (@schemaId is not null) set @schemaFilter = 'and o.schema_id = ' + convert(varchar, @schemaId)

    set @sql = '

    select

    o.[name],

    substring (c.[text], patindex(''' + @wildcard + ''', c.[text]) -50, patindex(''' + @wildcard + ''', c.[text]) +255)

    from ['+db_name()+'].sys.syscomments c (nolock)

    join ['+db_name()+'].sys.objects o (nolock) on o.object_id = c.id

    where 1=1

    ' + @schemaFilter + '

    and c.text like ''' + @wildcard + '''

    and o.[name] not like ''[_]%''

    and o.[name] not like ''sys%''

    and o.[name] not like ''sp[_]sel[_]%''

    and o.[name] not like ''sp[_]ins[_]%''

    and o.[name] not like ''sp[_]upd[_]%''

    and o.[name] not like ''__[_]cft[_]%''

    and o.[name] not like ''ctsv[_]%''

    and o.[name] not like ''tsvw[_]%''

    and o.[name] not like ''del[_]%''

    and o.[name] not like ''ins[_]%''

    and o.[name] not like ''sel[_]%''

    and o.[name] not like ''upd[_]%''

    and o.[name] not like ''ms[_]bi%''

    and o.[name] not like ''msmerge[_]contents%''

    and o.[name] <> replace(replace(''' + @searchText + ''', ''['', ''''), '']'', '''')

    '

    exec(@sql)

    end

Viewing 15 posts - 1 through 15 (of 25 total)

You must be logged in to reply to this topic. Login to reply