[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 832
  • Last Modified:

SQL Server 2008 Express - How to find a record in a table with a specific text in one of its field

Hello,

I am trying to find a record in my SQL Server 2008 express database TABLE object.
I am trying to find a record with the text "Jack" in the first name field in a table named students.
I have opened the table in SQL Server 2008 management studio by right clicking the table object and clicking 'Edit Top 1000 rows'.

Edit Top 1000 rows
Then I tried to select the 'FirstName' table column heading using the mouse but I couldn't - I actually wanted to select the table header then press Ctrl+F key to open the Find/Search dialog box and search for the text "Jack" in the first name field. This method of finding a record with a specific text in a field worked fine in MS Access.

Couldn't select table column header
So, then I tried to open the table by right clicking the table object and clicking 'Select Top 1000 rows'.

Select Top 1000 rows
Luckly I could select the First name column. However when I pressed the Ctrl+F key and searched for the text "Jack" in the first name field, SQL Server management studio says Text not found.

Searching for a record using Ctrl   F
Text not found
So, my question is, Is there a simple way of finding a record in SQL server database table containing a specific word without creating a view/query? I want to quickly find a record and edit the record directly, rather than having to create a new view in SQL Server management studio to search for the record.
0
ZKM128
Asked:
ZKM128
3 Solutions
 
tigin44Commented:
the simplest way is running a query like this one

SELECT *
FROM students
WHERE name = 'Jack'
0
 
tigin44Commented:
but if you want to do this by using the designer interface, after righ clicking and choosing the edit top 200 records of table you should open the query designer from the left of the management studio interface. once you open the designer then you should specify any query condition and sort order... I cant gave you any snapshot cause no SSMS installed on the machine currently I'm using.
0
 
p_nutsCommented:
Running a query is easiest

Like tigin44 posted you might need to use % as a wildcard

So
SELECT *
FROM students
WHERE name = '%jack%'
0
 
EvilPostItCommented:
One reason you may not be seeing the results you expect is because you are only seeing the first 1000 records, if there are more than this then you would not be able to see them.

Instead if choosing "Edit top 1000 records" choose "SELECT TOP 1000 records" and add a where clause so it looks like the below.

SELECT * FROM Students WHERE NAME LIKE '%jack%'

Open in new window


From your example i can see you have an ID field too so if you want to update a specific row you could run the following update command.

UPDATE STUDENTS
SET NAME='James'
WHERE ID=7

Open in new window


Or if you wanted to set the column that has Jack in it to James you could run the following query.

UPDATE STUDENTS
SET NAME='James'
WHERE Name LIKE '%Jack%'

Open in new window

0
 
ZKM128Author Commented:
Thank you,
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Tackle projects and never again get stuck behind a technical roadblock.
Join Now