Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


String Search


String Search

Author
Message
itisme_fred
itisme_fred
Forum Newbie
Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)

Group: General Forum Members
Points: 5 Visits: 52
The procedure does not search primary key content.
Sean Smith-776614
Sean Smith-776614
SSC-Addicted
SSC-Addicted (431 reputation)SSC-Addicted (431 reputation)SSC-Addicted (431 reputation)SSC-Addicted (431 reputation)SSC-Addicted (431 reputation)SSC-Addicted (431 reputation)SSC-Addicted (431 reputation)SSC-Addicted (431 reputation)

Group: General Forum Members
Points: 431 Visits: 943
Yes it does:

USE tempdb

CREATE TABLE test (somevarchar VARCHAR (100) PRIMARY KEY CLUSTERED)

INSERT INTO test VALUES ('does it seach PK')

EXEC "database the proc is in".dbo.usp_String_Search

@v_Search_String = 'does it seach PK'
,@v_Database_Name = 'tempdb'
itisme_fred
itisme_fred
Forum Newbie
Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)

Group: General Forum Members
Points: 5 Visits: 52
I re-created the stored procedure and it is working now, but I cannot get it working with INT.

USE tempdb

CREATE TABLE test (LoanNum VARCHAR (10) PRIMARY KEY CLUSTERED, OfficeID INT )

INSERT INTO test VALUES ('100001', 1)
INSERT INTO test VALUES ('100002', 2)
INSERT INTO test VALUES ('100003', 3)

EXEC DBAdmin.dbo.usp_String_Search
@v_Search_String = '2'
,@v_Database_Name = 'tempdb'
,@v_Data_Types = N'INT'

DROP TABLE TEST
Sean Smith-776614
Sean Smith-776614
SSC-Addicted
SSC-Addicted (431 reputation)SSC-Addicted (431 reputation)SSC-Addicted (431 reputation)SSC-Addicted (431 reputation)SSC-Addicted (431 reputation)SSC-Addicted (431 reputation)SSC-Addicted (431 reputation)SSC-Addicted (431 reputation)

Group: General Forum Members
Points: 431 Visits: 943
As mentioned in the article it only checks against the following data types:

CHAR, NCHAR, NTEXT, NVARCHAR, TEXT, VARCHAR, and XML
albertus.vandenberg
albertus.vandenberg
Grasshopper
Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)

Group: General Forum Members
Points: 23 Visits: 46
Thanks a million.

I have one that search only one data type, but I could search for a list of values. This one will fill the gap for me.
Sean Smith-776614
Sean Smith-776614
SSC-Addicted
SSC-Addicted (431 reputation)SSC-Addicted (431 reputation)SSC-Addicted (431 reputation)SSC-Addicted (431 reputation)SSC-Addicted (431 reputation)SSC-Addicted (431 reputation)SSC-Addicted (431 reputation)SSC-Addicted (431 reputation)

Group: General Forum Members
Points: 431 Visits: 943
Glad you like it. Smile
peter.mauss
peter.mauss
Grasshopper
Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)

Group: General Forum Members
Points: 17 Visits: 20
Cool Script.
Would be much cooler, if it would Output the primary key and its value for each occurence...
Sean Smith-776614
Sean Smith-776614
SSC-Addicted
SSC-Addicted (431 reputation)SSC-Addicted (431 reputation)SSC-Addicted (431 reputation)SSC-Addicted (431 reputation)SSC-Addicted (431 reputation)SSC-Addicted (431 reputation)SSC-Addicted (431 reputation)SSC-Addicted (431 reputation)

Group: General Forum Members
Points: 431 Visits: 943
Can you explain a bit more what you mean?
below86
below86
SSChasing Mays
SSChasing Mays (642 reputation)SSChasing Mays (642 reputation)SSChasing Mays (642 reputation)SSChasing Mays (642 reputation)SSChasing Mays (642 reputation)SSChasing Mays (642 reputation)SSChasing Mays (642 reputation)SSChasing Mays (642 reputation)

Group: General Forum Members
Points: 642 Visits: 2130
I like the idea of this but the only issue I have is this, If I want to run this against our production warehouse I'm not going to have rights to create a stored procedure.

Maybe later I'll look into modifying it to not be a stored procedure for what I will need.

Thanks again for the base code at least.

-------------------------------------------------------------
we travel not to escape life but for life not to escape us
peter.mauss
peter.mauss
Grasshopper
Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)

Group: General Forum Members
Points: 17 Visits: 20
Yes, it displays the
object_name, the column_name for each hit. It would be cool if it would also Display
the Name of the Primary key column for the object and its value so a further query could be formed later on.
Something like "select [pkey_name],[column_name] from [object_name] where [pkey_name]=[pkey_value]"
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search