A C# / SQL Query Problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Cem Louis

    A C# / SQL Query Problem

    Hi,

    I want to send to SQL server a query I want to get randomly generated
    100 rows where they are no generated before. I made my query like
    below:

    mySqlCommand.Co mmandText = "SELECT name,rand(name) FROM people LIMIT
    100 WHERE generated_befor e IS NULL";

    Gives system error???

    Thank you,
    Cem Louis
  • Rico Wind

    #2
    Re: A C# / SQL Query Problem

    cemlouis@phreak er.net (Cem Louis) writes:
    [color=blue]
    > Hi,
    >
    > I want to send to SQL server a query I want to get randomly generated
    > 100 rows where they are no generated before. I made my query like
    > below:
    >
    > mySqlCommand.Co mmandText = "SELECT name,rand(name) FROM people LIMIT
    > 100 WHERE generated_befor e IS NULL";[/color]
    Use
    "SELECT name FROM people ORDER BY NEWID() LIMIT 100"

    /rw

    Comment

    • Rico Wind

      #3
      Re: A C# / SQL Query Problem

      Rico Wind <rw@blade22.cs. aau.dk> writes:
      [color=blue]
      > cemlouis@phreak er.net (Cem Louis) writes:
      >[color=green]
      > > Hi,
      > >
      > > I want to send to SQL server a query I want to get randomly generated
      > > 100 rows where they are no generated before. I made my query like
      > > below:
      > >
      > > mySqlCommand.Co mmandText = "SELECT name,rand(name) FROM people LIMIT
      > > 100 WHERE generated_befor e IS NULL";[/color]
      > Use
      > "SELECT name FROM people ORDER BY NEWID() LIMIT 100"[/color]
      Sorry, not sure the above works, this should however work just fine
      "SELECT TOP 100 name FROM people ORDER BY NEWID()"

      /rw

      Comment

      • Cem Louis

        #4
        Re: A C# / SQL Query Problem

        Thank you Rico,

        It is working right...

        *** Sent via Developersdex http://www.developersdex.com ***
        Don't just participate in USENET...get rewarded for it!

        Comment

        Working...