Viewing 15 posts - 406 through 420 (of 429 total)
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...
June 1, 2005 at 10:13 am
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'...
June 1, 2005 at 9:39 am
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...
June 1, 2005 at 8:59 am
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...
June 1, 2005 at 8:40 am
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 ' +
June 1, 2005 at 8:28 am
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...
June 1, 2005 at 8:07 am
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...
May 31, 2005 at 5:44 pm
My mind was sleeping. Thanks
May 31, 2005 at 12:21 pm
Can you give some sample data as per my previous reply in this thread.
May 31, 2005 at 12:17 pm
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 *...
May 31, 2005 at 12:12 pm
--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...
May 31, 2005 at 12:07 pm
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...
May 31, 2005 at 11:50 am
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...
May 31, 2005 at 11:31 am
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...
May 31, 2005 at 10:52 am
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)...
May 31, 2005 at 10:30 am
Viewing 15 posts - 406 through 420 (of 429 total)