Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Question about Querying in SQL Database

Question about Querying in SQL Database

Scheduled Pinned Locked Moved Database
databasequestioncsharpsql-serversysadmin
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    wienzzz
    wrote on last edited by
    #1

    Hai, I have question about SQL database. I'm using C#2005 let's assume I have a database table 'TEST' with field 'myField' TEST ---------------- Recno | myField ---------------- 1 | axcel 2 | áxcel 3 | axcël 4 | axÇel 5 | áxÇèl ---------------- If I fire the command "SELECT * FROM TEST WHERE TEST.myField LIKE '%axce%'" The query result would be TEST ---------------- Recno | myField ---------------- 1 | axcel ---------------- my Question is : 1. Is there anyway so the query result would contain all of the record instead of first record only?? I assume this has something to do with Localization class in C#. Am I right? 2. If not possible, any suggestion how to make it possible? maybe using Function in SQL Server? I'm barely new to SQL server.. thankz for the information, if this question goes in wrong forum, please forgive me 1st.. regards ~erwin~ Mail me at erwin@holyknight.us

    P C 2 Replies Last reply
    0
    • W wienzzz

      Hai, I have question about SQL database. I'm using C#2005 let's assume I have a database table 'TEST' with field 'myField' TEST ---------------- Recno | myField ---------------- 1 | axcel 2 | áxcel 3 | axcël 4 | axÇel 5 | áxÇèl ---------------- If I fire the command "SELECT * FROM TEST WHERE TEST.myField LIKE '%axce%'" The query result would be TEST ---------------- Recno | myField ---------------- 1 | axcel ---------------- my Question is : 1. Is there anyway so the query result would contain all of the record instead of first record only?? I assume this has something to do with Localization class in C#. Am I right? 2. If not possible, any suggestion how to make it possible? maybe using Function in SQL Server? I'm barely new to SQL server.. thankz for the information, if this question goes in wrong forum, please forgive me 1st.. regards ~erwin~ Mail me at erwin@holyknight.us

      P Offline
      P Offline
      pmarfleet
      wrote on last edited by
      #2

      The query is returning the expected results. Only one of your five records contains the string pattern 'axce'. The other records contain different characters. You would need to modify your LIKE clause to account for accented characters. Paul

      1 Reply Last reply
      0
      • W wienzzz

        Hai, I have question about SQL database. I'm using C#2005 let's assume I have a database table 'TEST' with field 'myField' TEST ---------------- Recno | myField ---------------- 1 | axcel 2 | áxcel 3 | axcël 4 | axÇel 5 | áxÇèl ---------------- If I fire the command "SELECT * FROM TEST WHERE TEST.myField LIKE '%axce%'" The query result would be TEST ---------------- Recno | myField ---------------- 1 | axcel ---------------- my Question is : 1. Is there anyway so the query result would contain all of the record instead of first record only?? I assume this has something to do with Localization class in C#. Am I right? 2. If not possible, any suggestion how to make it possible? maybe using Function in SQL Server? I'm barely new to SQL server.. thankz for the information, if this question goes in wrong forum, please forgive me 1st.. regards ~erwin~ Mail me at erwin@holyknight.us

        C Offline
        C Offline
        Colin Angus Mackay
        wrote on last edited by
        #3

        wienzzz wrote:

        1. Is there anyway so the query result would contain all of the record instead of first record only??

        Yes.

        wienzzz wrote:

        I assume this has something to do with Localization class in C#. Am I right?

        No. It is to do with the collation sequence set up in the database. the column is AS (Accent Sensitive)

        wienzzz wrote:

        2. If not possible, any suggestion how to make it possible? maybe using Function in SQL Server? I'm barely new to SQL server..

        When you create the database the collation sequence should be defined as Accent Insensitive (AI). It causes more problems that it is worth to individually define columns as a specific collation.


        Upcoming FREE developer events: * Glasgow: db4o: An Embeddable Database Engine for Object-Oriented Environments, Mock Objects, SQL Server CLR Integration, Reporting Services ... My website

        W 1 Reply Last reply
        0
        • C Colin Angus Mackay

          wienzzz wrote:

          1. Is there anyway so the query result would contain all of the record instead of first record only??

          Yes.

          wienzzz wrote:

          I assume this has something to do with Localization class in C#. Am I right?

          No. It is to do with the collation sequence set up in the database. the column is AS (Accent Sensitive)

          wienzzz wrote:

          2. If not possible, any suggestion how to make it possible? maybe using Function in SQL Server? I'm barely new to SQL server..

          When you create the database the collation sequence should be defined as Accent Insensitive (AI). It causes more problems that it is worth to individually define columns as a specific collation.


          Upcoming FREE developer events: * Glasgow: db4o: An Embeddable Database Engine for Object-Oriented Environments, Mock Objects, SQL Server CLR Integration, Reporting Services ... My website

          W Offline
          W Offline
          wienzzz
          wrote on last edited by
          #4

          further question,

          When you create the database the collation sequence should be defined as Accent Insensitive (AI). It causes more problems that it is worth to individually define columns as a specific collation

          can I just modify the properties after the database created? I try to look for those properties and I couldn't find any properties related to that. Or should it be the SQL Server properties? (like in VFP to turn safety on or something like that?) second, let's assume that I couldn't change it (because I worked on existing database which I'm not able to change the structure), can I called a function to show the field in the view definition? well, maybe here's simple example (I'm not doing it yet) SELECT test.myField, myFunct(test.myField) as newfield FROM test assume that myFunct is the function to convert all the accented character to normal character. can it be the solution? CMIIW thankz for the information regards ~erwin~

          Mail me at erwin@holyknight.us

          C 1 Reply Last reply
          0
          • W wienzzz

            further question,

            When you create the database the collation sequence should be defined as Accent Insensitive (AI). It causes more problems that it is worth to individually define columns as a specific collation

            can I just modify the properties after the database created? I try to look for those properties and I couldn't find any properties related to that. Or should it be the SQL Server properties? (like in VFP to turn safety on or something like that?) second, let's assume that I couldn't change it (because I worked on existing database which I'm not able to change the structure), can I called a function to show the field in the view definition? well, maybe here's simple example (I'm not doing it yet) SELECT test.myField, myFunct(test.myField) as newfield FROM test assume that myFunct is the function to convert all the accented character to normal character. can it be the solution? CMIIW thankz for the information regards ~erwin~

            Mail me at erwin@holyknight.us

            C Offline
            C Offline
            Colin Angus Mackay
            wrote on last edited by
            #5

            wienzzz wrote:

            can I just modify the properties after the database created?

            You can modify each individual column. But it is best that it is done at database creation time - or server install time - because it can get in a complete mess if collation sequences are mixed between various columns.


            Upcoming FREE developer events: * Glasgow: db4o: An Embeddable Database Engine for Object-Oriented Environments, Mock Objects, SQL Server CLR Integration, Reporting Services ... My website

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups