SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


String Search


String Search

Author
Message
itisme_fred
itisme_fred
Valued Member
Valued Member (57 reputation)Valued Member (57 reputation)Valued Member (57 reputation)Valued Member (57 reputation)Valued Member (57 reputation)Valued Member (57 reputation)Valued Member (57 reputation)Valued Member (57 reputation)

Group: General Forum Members
Points: 57 Visits: 52
The procedure does not search primary key content.
Sean Smith (SSC)
Sean Smith (SSC)
Ten Centuries
Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)

Group: General Forum Members
Points: 1410 Visits: 1012
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
Valued Member
Valued Member (57 reputation)Valued Member (57 reputation)Valued Member (57 reputation)Valued Member (57 reputation)Valued Member (57 reputation)Valued Member (57 reputation)Valued Member (57 reputation)Valued Member (57 reputation)

Group: General Forum Members
Points: 57 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 (SSC)
Sean Smith (SSC)
Ten Centuries
Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)

Group: General Forum Members
Points: 1410 Visits: 1012
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
SSC Rookie
SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)

Group: General Forum Members
Points: 33 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 (SSC)
Sean Smith (SSC)
Ten Centuries
Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)

Group: General Forum Members
Points: 1410 Visits: 1012
Glad you like it. Smile
peter.mauss
peter.mauss
SSC Rookie
SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)

Group: General Forum Members
Points: 27 Visits: 20
Cool Script.
Would be much cooler, if it would Output the primary key and its value for each occurence...
Sean Smith (SSC)
Sean Smith (SSC)
Ten Centuries
Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)

Group: General Forum Members
Points: 1410 Visits: 1012
Can you explain a bit more what you mean?
below86
below86
SSCommitted
SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)

Group: General Forum Members
Points: 1728 Visits: 2715
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
SSC Rookie
SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)

Group: General Forum Members
Points: 27 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