Lefteris Gkinis
Lefteris Gkinis

Reputation: 1259

Wildcard asterisk character ("*") in SQL database

Can we use the asterisk character * for a search action in SQL database?

MASQLComm = New SqlCommand("SELECT COUNT(*) AS [RecCount] 
                              From " & tName & " 
                             WHERE " & tName & fName & " = '" & {*} & ".Temp' ", 
                            SQLConn)

Please advice me with a code for this.

Upvotes: 1

Views: 4767

Answers (2)

decyclone
decyclone

Reputation: 30820

Use LIKE operator to do that.

Also I would strongly recommend against building your SQL query like that. Do it if there is no other way.

Upvotes: 4

Mark Sowul
Mark Sowul

Reputation: 10600

For text you need LIKE with '%'. But make sure you're acquainted with Bobby Tables. http://xkcd.com/327/

Upvotes: 9

Related Questions