Forum Replies Created

Viewing 15 posts - 406 through 420 (of 429 total)

  • RE: SQL Statement and Variables

    Ha I did not realize that how about this

         SELECT col1, col2, col3

         FROM   #tbl

         ORDER  BY CASE @SortCol

                      WHEN 'col1' THEN CASE @SortYpe WHEN 'DESC' THEN 1 DESC ELSE...

  • RE: SQL Statement and Variables

    I agree may be not if I use 15 lines like this

         SELECT col1, col2, col3

         FROM   #tbl

         ORDER  BY CASE @SortCol

                      WHEN 'col2' THEN CASE @SortYpe WHEN 'DESC'...

  • RE: SQL Statement and Variables

    Thanks Remi.

    I have to use SqlDataReader since it is faster. This does not have a sort method as far as I know. So I had to use back end...

  • RE: Column values in a row

    Thanks David That does the trick. Can we say still it is in a hidden loop.

    I did in a different way. My function returns a table with all the machine which...

  • RE: SQL Statement and Variables

    Remi I use dynamic sql for sorting something like this

    CREATE PROCEDURE GetDetails

    (

    @sort VARCHAR(25)

    )

    AS

    SET NOCOUNT ON

    DECLARE @sql = 'SELECT * FROM TableName ORDER BY ' +

  • RE: SQL Statement and Variables

    You have to use dynamic SQL. Note: If this query is part of stored procedure and if you have exec permission on stored procedure and no select permission on table...

  • RE: Using the IN operator with a variable

    Solution is good. I would like to do it another way.

    Please note Dynamic SQL will not work when the user has execute rights on a stored procedure and no select...

  • RE: Problem converting numbers from scientific fromat

    My mind was sleeping. Thanks

  • RE: Testing for whether there is an existing value?

    Can you give some sample data as per my previous reply in this thread.

  • RE: Need quick SQL solution

    select min(userid), count(*) Logins from tLogins

    where userid>=1 and userid<=20

    group by userid ORDER BY 2 DESC

    You can sort it by column Number or if you want to specify names

    SELECT *...

  • RE: Problem converting numbers from scientific fromat

    --srikant B and Noel.

    --I have noticed problems in VARCHAR itself.

    Declare @val Varchar

    set @val = '-3.16E-05'

    SELECT @val Value --gives a value of.

    Value...

  • RE: Creating a new identifier column

    I tried with following example. It works on the primary key. Execute it with primary key then remove the primary key and see the difference.

    May be some one with...

  • RE: Optimized SQL for Name Search

    That will list all the values that are null and match the search criteria.

    For not including the parameters that are not passed got to use a CASE or IF ELSE...

  • RE: Testing for whether there is an existing value?

    DECLARE @Contact TABLE

    (

    ContactID   INT IDENTITY,

    ContactName VARCHAR(100)

    )

    INSERT @Contact VALUES ('Contact 1')

    INSERT @Contact VALUES ('Contact 2')

    INSERT @Contact VALUES ('Contact 3')

    INSERT @Contact VALUES ('Contact 4')

    INSERT @Contact VALUES ('Contact 5')

    DECLARE @Phone TABLE

    (

    ContactID...

  • RE: Finding Characters Patterns

    Remi's Solution works for me -- not for text columns though

    DECLARE @Proposal TABLE

    (

    Surname VARCHAR(100)

    )

    INSERT @Proposal VALUES ('ABCD')

    INSERT @Proposal VALUES ('ABCD' + CHAR(128) + 'EFGH')

    INSERT @Proposal VALUES ('ABCD' + CHAR(200)...

Viewing 15 posts - 406 through 420 (of 429 total)