Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    MS SQL Server


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Dynamic Sort Column And Sort Order Not Working


I am trying to set sorting up on a DataGrid in ASP.NET 2.0.  I have it working so that when you click on the column header, it sorts by that column, what I would like to do is set it up so that when you click the column header again it sorts on that field again, but in the opposite direction.
 
I have it working using the following code in the stored procedure:
 
  CASE WHEN @SortColumn = 'Field1' AND @SortOrder = 'DESC' THEN Convert(sql_variant, FileName) end DESC,
case when @SortColumn = 'Field1' AND @SortOrder = 'ASC' then Convert(sql_variant, FileName) end ASC,
case WHEN @SortColumn = 'Field2' and @SortOrder = 'DESC' THEN CONVERT(sql_variant, Convert(varchar(8000), FileDesc)) end DESC,
case when @SortColumn = 'Field2' and @SortOrder = 'ASC' then convert(sql_variant, convert(varchar(8000), FileDesc)) end ASC,
case when @SortColumn = 'VersionNotes' and @SortOrder = 'DESC' then convert(sql_variant, convert(varchar(8000), VersionNotes)) end DESC,
case when @SortColumn = 'VersionNotes' and @SortOrder = 'ASC' then convert(sql_variant, convert(varchar(8000), VersionNotes)) end ASC,
case WHEN @SortColumn = 'FileDataID' and @SortOrder = 'DESC' THEN CONVERT(sql_variant, FileDataID) end DESC,
case WHEN @SortColumn = 'FileDataID' and @SortOrder = 'ASC' THEN CONVERT(sql_variant, FileDataID) end ASC
 
 And I gotta tell you, that is ugly code, in my opinion.  What I am trying to do is something like this:
 
 case when @SortColumn = 'Field1' then FileName end,
case when @SortColumn = 'FileDataID' then FileDataID end,
case when @SortColumn = 'Field2' then FileDesc
when @SortColumn = 'VersionNotes' then VersionNotes
end

case when @SortOrder = 'DESC' then DESC
when @SortOrder = 'ASC' then ASC
end
 
 and it's not working at all, i get an error saying:  Incorrect syntax near the keyword 'case'
 
when i put a comma after the end on line  5 i get: Incorrect syntax near the keyword 'DESC'
 
What am I missing here?
 
Thanks in advance for any help
 
-Madrak 




View Complete Forum Thread with Replies

Related Forum Messages:
Sql SORT Order Not Working On Numbers?
Hello all... I'm using asp to get records from an access database, verysimilar to the way datagrid would work. The title of each column in my tableis a link that alternates the sort order between ascending and descending...my problem is that text WILL change its sort order just fine but nubers arenot always in order. ie: if sort order is ASC (ascending) I might see 2000,234, 789 (should be ordered but its not). I'm guessing that ASP is handingthe string as a text string (?) and getting confused, is there a way toforce ASP into treating the string as numerals if this is the case? anyother ideas? Thanks so much.here is one of my sql commands in case you want to see it. "sort" is avariable containing the recordset to sort by depending on which link isclicked. I hope I didn't confuse the whole issue because of a lack ofcaffiene over here :)strsql = "SELECT * FROM comments ORDER BY " & sort & " DESC"Thanks of the help, much appreciated.Eno

View Replies !
Paging And Dynamic Sort Order (ASC/DESC)
Hi all,I have a SQL statement that allows paging and dynamic sorting of thecolumns, but what I can't figure out without making the SQL a dynamicstring and executing it, or duplicating the SQL statement between anIF and ELSE statement.Following is the SQL statement;set ANSI_NULLS ONset QUOTED_IDENTIFIER ONgoALTER PROCEDURE [dbo].[sp_search]@search VARCHAR( 80 ), @startRow INT = 1, @endRow INT = NULL, @postcode AS CHAR( 4 ) = NULL, @suburb AS VARCHAR( 40 ) = NULL, @stateIdentity AS TINYINT = NULL, @fromLatitude AS REAL = NULL -- latitude the user is located in, @fromLongitude AS REAL = NULL -- longitude the user is located in, @sort TINYINT = 1ASBEGINSET NOCOUNT ON;DECLARE @calculateDistance BIT;SET @calculateDistance = 0;-- get the longitude and latitude if requiredIF ( NOT @postcode IS NULL )BEGINSELECTDISTINCT@fromLatitude = latitude, @fromLongitude = longitudeFROMtbl_postalcodeWHERE(postalcode = @postcode)SET @calculateDistance = 1ENDELSE IF ( NOT @suburb IS NULL AND NOT @stateIdentity IS NULL )BEGINSELECTDISTINCT@fromLatitude = latitude, @fromLongitude = longitudeFROMtbl_localityWHERE(locality = @suburb)AND(stateIdentity = @stateIdentity)SET @calculateDistance = 1END/*ELSE IF ( @fromLatitude IS NULL AND @fromLongitude IS NULL )BEGINRAISERROR( 'You need to pass a valid combination to this storedprocedure, example: postcode or suburb and state identity or longitudeand latitude', 18, 1 );END*/SELECT D1.[row], D1.[totalRecordCount], D1.[classifiedIdentity], D1.[title], D1.[summary], D1.[price], D1.[locality], D1.[state], D1.[postcode], D1.[addedLast24], D1.[dateStamp], D1.[t2Rank], D1.[t3Rank], D1.[tRank], D1.[distance], F.[originalName], F.[extension], F.[uniqueName]FROM(-- derived tableSELECT ROW_NUMBER() OVER ( ORDER BY CASE @sort WHEN 0 THENCAST( COALESCE( t2.RANK, 0 ) + COALESCE( t3.RANK, 0 ) AS CHAR( 5 ) )WHEN 1 THEN C.title WHEN 2 THEN CAST( CEILING( [dbo].[fn_calculateDistance] ( @fromLatitude, @fromLongitude, L.latitude,L.longitude ) ) AS CHAR( 9 ) ) WHEN 3 THEN ( C.locality + ' ' +C.state ) WHEN 4 THEN CAST( C.price AS CHAR( 10 ) ) END ASC ) AS row, COUNT( * ) OVER() AS totalRecordCount, C.[classifiedIdentity], C.[title], C.[summary], C.[price], C.[locality], C.[state], C.[postcode], CASE WHEN ( C.[dateStamp] >= DATEADD( day, -1, GETDATE() ) )THEN 1 ELSE 0 END AS addedLast24, C.[dateStamp]/* , t1.RANK AS t1Rank */, t2.RANK AS t2Rank, t3.RANK AS t3Rank, /* COALESCE( t1.RANK, 0 ) + */ COALESCE( t2.RANK, 0 ) +COALESCE( t3.RANK, 0 ) AS tRank, CASE @calculateDistance WHEN 1 THEN CEILING( [dbo].[fn_calculateDistance] ( @fromLatitude, @fromLongitude, L.latitude,L.longitude ) ) ELSE 0 END AS distanceFROM [tbl_classified] AS CINNER JOINtbl_locality LONC.localityIdentity = L.localityIdentity/* LEFT OUTER JOINCONTAINSTABLE( tbl_category, title, @keyword ) ASt1ON FT_TBL.categoryIdentity = t1.[KEY] */LEFT OUTER JOINCONTAINSTABLE( tbl_classified, title, @search ) ASt2ON C.classifiedIdentity = t2.[KEY]LEFT OUTER JOINCONTAINSTABLE( tbl_classified, description,@search ) AS t3ON C.classifiedIdentity = t3.[KEY]WHERE ( /* COALESCE( t1.RANK, 0 ) + */COALESCE( t2.RANK, 0 ) +COALESCE( t3.RANK, 0 ) ) != 0) AS D1LEFT OUTER JOINtbl_classified_file CFOND1.classifiedIdentity = CF.classifiedIdentityLEFT OUTER JOINtbl_file FONF.fileIdentity = CF.fileIdentityWHERE( row >= @startRow )AND( @endRow IS NULL OR row <= @endRow )ENDThe part I'm having trouble with is making the sort order in thefollowing line dynamicORDER BY CASE @sort WHEN 0 THEN CAST( COALESCE( t2.RANK, 0 ) +COALESCE( t3.RANK, 0 ) AS CHAR( 5 ) ) WHEN 1 THEN C.title WHEN 2 THENCAST( CEILING( [dbo].[fn_calculateDistance] ( @fromLatitude,@fromLongitude, L.latitude, L.longitude ) ) AS CHAR( 9 ) ) WHEN 3 THEN( C.locality + ' ' + C.state ) WHEN 4 THEN CAST( C.price ASCHAR( 10 ) ) END ASCany help would be greatly apprecaited.Thanks

View Replies !
How To Sort Date Column In ASC Order?
hi all.
i am getting screwy results when i try to order the "the_date"
column of my RecentLogin table. The below select statement
should order the "the_date" column in cronological ascending
order (defaults to ASC when not specified) but it goes August, October, September. And, not August, September, October.
Any ideas why this is happening? Thanks.

PS - for what it is worth, this column is stored as a VARCHAR and not a DateTime


Code:


select * from RecentLogin order by the_date



Quote:
Aug 23 2006 3:00PM
Oct 3 2006 9:45PM
Oct 6 2006 2:24PM
Oct 8 2006 6:57PM
Oct 8 2006 7:27PM
Oct 8 2006 9:42PM
Oct 8 2006 11:15AM
Oct 8 2006 11:35AM
Oct 8 2006 11:45PM
Oct 9 2006 1:13PM
Oct 9 2006 10:47AM
Oct 12 2006 7:30PM
Oct 12 2006 10:01AM
Oct 12 2006 12:28AM
Oct 13 2006 4:34PM
Oct 13 2006 9:32AM
Oct 16 2006 8:01PM
Oct 17 2006 9:22AM
Sep 3 2006 11:10PM
Sep 3 2006 11:12PM
Sep 3 2006 11:12PM
Sep 3 2006 11:15PM
Sep 3 2006 11:15PM
Sep 3 2006 11:16PM
Sep 3 2006 11:16PM
Sep 3 2006 11:17PM
Sep 3 2006 11:17PM
Sep 5 2006 1:29PM
Sep 5 2006 1:30PM
Sep 5 2006 2:32PM
Sep 7 2006 8:49PM
Sep 9 2006 10:48PM
Sep 1 2006 3:00PM
Sep 13 2006 3:14PM
Sep 14 2006 5:07PM
Sep 15 2006 8:46AM
Sep 17 2006 9:40PM
Sep 19 2006 2:39PM
Sep 19 2006 2:44PM
Sep 21 2006 9:31AM

View Replies !
Default Sort Order When Order By Column Value Are All The Same
Hi,
We got a problem.
supposing we have a table like this:

CREATE TABLE a (
aId int IDENTITY(1,1) NOT NULL,
aName string2 NOT NULL
)
go
ALTER TABLE a ADD
CONSTRAINT PK_a PRIMARY KEY CLUSTERED (aId)
go


insert into a values ('bank of abcde');
insert into a values ('bank of abcde');
...
... (20 times)

select top 5 * from a order by aName
Result is:
6Bank of abcde
5Bank of abcde
4Bank of abcde
3Bank of abcde
2Bank of abcde

select top 10 * from a order by aName
Result is:
11Bank of abcde
10Bank of abcde
9Bank of abcde
8Bank of abcde
7Bank of abcde
6Bank of abcde
5Bank of abcde
4Bank of abcde
3Bank of abcde
2Bank of abcde

According to this result, user see the first 5 records with id 6, 5, 4, 3, 2 in page 1, but when he tries to view page 2, he still see the records with id 6, 5, 4, 3, 2. This is not correct for users. :eek:

Of course we can add order by aid also, but there are tons of sqls like this, we can't update our application in one shot.

So I ask for your advice here, is there any settings can tell the db use default sort order when the order by column value are the same? Or is there any other solution to resolve this problem in one shot?

View Replies !
Default Sort Order When The Order By Column Value Are All The Same
Hi,
   We got a problem.
   supposing we have a table like this:
 
CREATE TABLE a (
    aId             int         IDENTITY(1,1) NOT NULL,
    aName           string2     NOT NULL
)
go
ALTER TABLE a ADD
    CONSTRAINT PK_a PRIMARY KEY CLUSTERED (aId)
go

insert into a values ('bank of abcde');
insert into a values ('bank of abcde');
...
... (20 times)
 
select top 5 * from a order by aName
Result is:
6 Bank of abcde
5 Bank of abcde
4 Bank of abcde
3 Bank of abcde
2 Bank of abcde
 
select top 10 * from a order by aName
Result is:
11  Bank of abcde
10  Bank of abcde
9    Bank of abcde
8    Bank of abcde
7    Bank of abcde
6    Bank of abcde
5    Bank of abcde
4    Bank of abcde
3    Bank of abcde
2    Bank of abcde
 
According to this result, user see the first 5 records with id 6, 5, 4, 3, 2 in page 1, but when he tries to view page 2, he still see the records with id 6, 5, 4, 3, 2. This is not correct for users.
Of course we can add order by aid also, but there are tons of sqls like this, we can't update our application in one shot.
So I ask for your advice here, is there any settings can tell the db use default sort order when the order by column value are the same? Or is there any other solution to resolve this problem in one shot?

View Replies !
How To Sort Table In Sql2000 With Ipaddress(format X.x.x.x) As Column With Nvarchar Datatype In Ascending Order
How to sort table in sql2000 with ipaddress(format x.x.x.x) as column with nvarchar datatype in ascending order
without using stored procedure
 
Ex:
 
 Table: netComputers(3 rows)
 Column Name:  ipAddress (string data type)
 
ipAddress
0.0.18.1
0.1.1.2
0.0.0.1
 
Sql query : if I use the query
 
Select ipAddress  from netComputers order by  cast( replace(ipaddress,'.','') as numeric(12)) asc
 
Gives result as :  
ipAddress
0.0.0.1
0.1.1.2
0.0.18.1
 
Where as expected result should be:
 
ipAddress
0.0.0.1
0.0.18.1
0.1.1.2
 

View Replies !
Default Sort Order - Open Table - Select Without Order By
Hi!
 
I recently run into a senario when a procedure quiered a table without a order by clause. Luckily it retrived data in the prefered order.
 
The table returns the data in the same order in SQL Manager "Open Table"
 
So I started to wonder what deterimins the sort order when there is no order by clause ?
 
I researched this for a bit but found no straight answers. My table has no PK, but an identiy column.
 
Peace.
 
/P

View Replies !
Inconsistent Sort Order Using ORDER BY Clause
I am getting the resultset sorted differently if I use a column number in the ORDER BY clause instead of a column name.

Product: Microsoft SQL Server Express Edition
Version: 9.00.1399.06
Server Collation: SQL_Latin1_General_CP1_CI_AS

for example,

create table test_sort
( description varchar(75) );

insert into test_sort values('Non-A');
insert into test_sort values('Non-O');
insert into test_sort values('Noni');
insert into test_sort values('Nons');

then execute the following selects:
select
*
from
test_sort
order by
cast( 1 as nvarchar(75));

select
*
from
test_sort
order by
cast( description as nvarchar(75));

Resultset1
----------
Non-A
Non-O
Noni
Nons

Resultset2
----------
Non-A
Noni
Non-O
Nons


Any ideas?

View Replies !
BCP And Sort Order
I need to copy the structure and data of an existing SQL 6.5 server to one with a different sort order. Normally, I would use the transfer tool to accomplish this, but the servers are on different networks. My question is, is BCP the answer? In other words, will the data copied via BCP from the sending server be able to be copied on the recieiving server. Also, is there a way to automatically generate the BCP statements for all tables? What I would really like is to be able to get at the scripts and data files created by the transfer tool.

View Replies !
Sort Order
What is the standard sort order configuration for US?
sort order 33 or 52?

View Replies !
SQL 6.5 Sort Order
We have about 90 servers we need to change the sort order on to become standard with our CIO group.

Our current sort order is dictionary order - case insensitive. We need to change to dictionary order - case insensitive - accent insensitive.

I know the standard procedure is to use transfer manager or bcp all data out out to files, then re-install SQL or rebuild master.

Because of the size of this project, I would like to find an easier way to do this.
If anyone has any ideas, please reply.

Thanks,
Chris

View Replies !
Sort Order ID&#39;s
I'm trying to setup a duplicate of an old SQL Server 4.2 server to put in place while we upgrade the server, but I can't get the sort-order right. I know the existing server uses sort order id 40, but I can't find which sort-order that corresponds to during the install process. If anyone can give me a system table that lists all the sort orders names and id's, or can tell me what the text name for sort order 40 is, I would be very grateful.

Thanks,
Rob.

View Replies !
Sort Order Id 42 ?
Hi,
Can any one pls tell me what this sort order id 42 corresponds to and how its different from 52 ?
What options i need to check during installation for sort oreder id. ?

Thanks
Srinivas

View Replies !
Specifying Sort Order
Anyone know whether I can do a specific sort order in sql statement instead of using
ascending or descending order?
for example:

col1 - 1, 2, 3, 4, 5, 6

I need a result to display 3,1,2,5,6,4

Thank you.

View Replies !
Sort Order
How can I set the sort order to 42, nocase when I install sql server 6.5
does Setup gives you some option to check to set sort order ?

View Replies !
Sort Order
For SQL 2000,
Can I assign different sort order on the database level?

thanks!

View Replies !
Sort Order
We have a vendor who insists that sql server 7 be set to a binary sort order. Is there any real advantage to this as opposed to a dictionary sort?

View Replies !
SORT ORDER
HOW CAN I CHECK THE SORT ORDER OF MY OLD SERVER?

HELP

View Replies !
Sort Order Id. ?
Hi,
I am trying to restore .DAT file from dump. Its giving me error ..saying that the sort order id used for dumping was 42 not the default value 52.

How can i change the sort order to 42.
I am using sql server 6.5


Thanks
Srinivas

View Replies !
Sort Order
How do I create a sort order column in a view? I could use Row_Number() in 2005 but unfortunately I need to create a sort order column in a 2000 view and the View is not letting me to use an ORDER BY.

Any inputs?

Prakash.P
The secret to creativity is knowing how to hide your sources!

View Replies !
Specify Specific Sort Order....
I would like to format the output of a query. I have a few CaseCategoryID's I would like to sort; however, I do not want to sort them ascending or descending, I want to sort them by CaseCategoryID 3, then 8, then 4, then 11, and then the rest. Is this possible?

View Replies !
SQL Server Sort Order
Is there a way to change the SQL Server sort order at the database level?
Is it possible to have 2 different database on the same server with different sort orders?

View Replies !
Binary Sort Order
Binary sort order on SQL 7 is NOT the same as binary sort order in SQL 2000. SQL 2000 shows the databases brought over from the SQL 7 server generates a collation compatability error. I am seeing errors when running reports in Great Plains Dynamics.

Is there a work around to this?

Also why would Microsoft recommend DOCI over Binary sort order for their e-product offerings.

View Replies !
Sort Order& Char.set
I didn't install SQL Server myself and nobody remember what sort order and character set
were installed . How can I check it?
Thanks,
Alona F.

View Replies !
Change Sort Order In 6.5
Hi,

Is there any way to change the sort order from case sensitive to case insensitive in SQL Server 6.5 without having to rebuild the master db and all users db's.

thanks in advance.

View Replies !
Sort Order---urgent
Hi,
can anyone pls tell me.
while installing sql server6.5, which sort order i have to select for following sort order conditions. Because i dont want to install dictionary-sory order.

Sort Order = 49, caseless_34
Case-insensitive sort order for 3.4.1 caseless database.

Pls tell me which option i have to select for sort order while installing new sql server65.

venki

View Replies !
6.5 With Wrong Sort Order
One of our offices installed their SQL 6.5 and unfortunatly changed the sort order during the install. To use other software I need to restore the data to the default sort order. I have a copy of their backup tape to work from. I have some idea of the process to follow but if you have done it before I would greatly appreciate some guideance. Thanks.

View Replies !
Which Sort Order Installed
Hi,

Anyone know how to determine what sort order a SQL 6.5 server has been installed with, by using a T-sql Query ??

Regards

Niclas Lindblom

View Replies !
SORT Order In SQL2000
How can I alter the default SORT order when SQL2000 originally
installed ? --Is there a Store_Proc in SQL2000 to do this ?
Thank you very much if you can help me !!

Lewis

View Replies !
Chaning Sort Order
I have a SQL 2000 installation that is using the default sort order (Case-Insensitive). Now the developers want the sort order to be Case-Sensitive. Is there a simple way that I can change the sort order?

Thanks in advance!

View Replies !
Incorrect Sort Order.
I have select query that has text field in select list. When I use order by clause it gives me incorrect sort in result.

We are running SQL2K with service pack 4.

I find BUG #: 470536 on Microsoft site and it suggest applying service pack 4.

Is anyone has similar problem?

Thanks in advance.

View Replies !
Unicode Sort Order
Does anyone have any experience handling mixed-character data in Unicode, especially in how to handle sorting it?

For example, if I have a customer database with records from all over the world, with customer names in Chinese, Russian, Swedish, Arabic & Hebrew, and I want to generate a list of all customers who have not upgraded to the latst version yet, it will be sorted in the sort order of the locale I defined at DB installation. Say, in this case, US English. How do the Chinese, Arabic, Swedish, etc. characters get sorted?

I'm interested to know if this is something that people are grappling with out there, or whether it's a non-issue. I think what's probably needed is a special Unicode mixed-character sort order, encompasing all the Unicode codepoints and sorting them in an order that's as usable as possible for the general user. (e.g. Latin characters case-sensitive, including accented characters, then Asian characters in stroke order, etc.) Or maybe serveral different mixed-character sort orders would be the thing... Any feedback would be appreciated.

View Replies !
Difference Between Sort Order Id 52 And 42
Hi,

I have the following scenario. I have two nt machines with sql server 7 installed. On one all the default settings were assumed while on the other the default language settings was changed to South African. This causes the sort order id's to be different. ID 52 is the 1252 ISO Character set (dictonary order, case-insensitive) and ID 42 is 850 Multilingual (dictonary order, case-insensitive). The only problem so far is that I cannot back up on one machine and restore on another. My question is now what other differences there might be. How will it influence my database? We are using iso characters in both our databases. How will multilingual handle that?

Any thoughts would be appreciated

Thanks
Sonja

View Replies !
Can Not Attach -- Different Sort Order !!!
Help ...

Does this mean that I have to re-install SQL Server7 on the target server? For some reason, all except one (the source in this case) of our servers were set up taking the defaults (or at least they are all the same). I can not change the source.

Any advise, before I kill myself

Judith

View Replies !
Upgrade SQL 6.5 To 7.0 With Different Sort Order
Hi,

I am trying to upgrade peoplesoft database which is in SQL server 6.5 with Dictionary sort order to SQL Server 7.0 Binary sort order. SQL Server Upgrade wizard fails because of different sort order. If anyone knows about upgrading SQL Server 6.5 with Dictionary sort order to SQL 7.0 with Binary sort order, would be appreciated.

Thanks,
Mohana

View Replies !
What Is The Best Sort Order Choice ?
In Sql6.5 we use binary sort order for a best performance (I think). I hear that it should be highlighted that the case for binary sort order being the fastest method of sorting and searching a database no longer applies at SQL 7.0
Is it right and why ????

View Replies !
Sort Order On Insert
Are there any techniques I can use to specify the sort order on an insert statement.

I want to insert data from tableA to tableB in a certain order .

I know I can do it with a cursor, but I'm sure theres a better way

Pargat

View Replies !
Changing The Sort Order
Hi,

I want to change the "dictionary Sort Order" in SQL Server 7.0. What will be the impact? What is the safe way to do it?

Under MSSQL7INSTALL there is a file called instcat.sql. Should I run this file to change the catalog settings?

Any help is appriciated.

Thanks
Sri

View Replies !
Sp_attach_db And Sort Order
Hi,

I'm doing some work for a client who has not been backing up
his databases. After a server crash he has been left with
the .MDF and .LDF files. I have managed to successfully
use sp_attach_db on all but two databases. When attempting
to use sp_attach_db I get the following error message :

1> sp_attach_db @dbname = N'CSGDEV', @filename1 = N'e:SQL_DataDirDataCSGDEV_Data.MDF', @filename2 = N'e:SQL_DataDirDataCSGDEV_Log.LDF'
2> go
Warning: sort order 51 in database differs from server sort order of 52.
Warning: Unicode comparison flags 196608 in database differs from server
Unicode comparison flags of 196609.
Msg 1816, Level 16, State 1, Server CSGSERVER, Line 1
Could not attach the database because the character set, sort order, or Unicode
collation for the database differs from this server.
Warning: sort order 51 in database differs from server sort order of 52.
Warning: Unicode comparison flags 196608 in database differs from server
Unicode comparison flags of 196609.
Msg 1816, Level 16, State 1, Server CSGSERVER, Line 1
Could not attach the database because the character set, sort order, or Unicode
collation for the database differs from this server.

I'd appreciate any ideas. I'm not a SQL Server expert (heck, I'm not even
a Windows expert...) as you can probably tell.

Thanks and cheers,
Deeran

View Replies !
Sort (ORDER BY) Problem
 

When I create a VIEW using the "New View..." wizard in SQL Server Express Edition, and set Sort Type to "Ascending" for the LastName column, the dataset returned is not sorted.  On the other hand, if I execute a query by copying the T-SQL language from the wizard, and paste it directly into a new query, it is returned sorted as expected.
 
Code created by the wizard is:
 

SELECT TOP (100) PERCENT Title, LastName AS [Last Name], FirstName AS [First Name], Phone AS [Phone Number]

FROM Person.Contact

WHERE (Phone LIKE N'397%')

ORDER BY [Last Name]

 
Any idea why the direct query works properly, and the wizard does not?
 
Thanks,  Bill

View Replies !
Sort Order By Month
SELECT TOP (100) PERCENT Calendar_Key, Calendar_Date, Calendar_Year, Calendar_Month, Calendar_Quarter, Calendar_week, Calendar_DayOfMonth,
Calendar_DayOfYear, Calendar_Datename, Calendar_EndOfMonth, Calendar_EndOfQuarter, Calendar_EndOfYear,
CAST(CASE WHEN Calendar_Month = 1 THEN 'January' WHEN Calendar_Month = 2 THEN 'February' WHEN Calendar_Month = 3 THEN 'March' WHEN Calendar_Month
= 4 THEN 'April' WHEN Calendar_Month = 5 THEN 'May' WHEN Calendar_Month = 6 THEN 'June' WHEN Calendar_Month = 7 THEN 'July' WHEN Calendar_Month
= 8 THEN 'August' WHEN Calendar_Month = 9 THEN 'September' WHEN Calendar_Month = 10 THEN 'October' WHEN Calendar_Month = 11 THEN 'November'
WHEN Calendar_Month = 12 THEN 'December' END AS char(9)) AS Month
FROM EDW.Calendar_Dim
WHERE (Calendar_Year IS NOT NULL)
ORDER BY Calendar_Year, Calendar_Month

I have two vlaue prompts.. which show year & month, when we select year, it shows in order. when we select month, since its character, it showing from 'April, August....

but i want month prompt to start from Jan...

Any suggestion on how to modify..

thanks
Phanicrn

View Replies !
Sort In Lexicographic Order?
How to sort elements in column in lexicographic order?
Regards,
H

View Replies !
Collation And Sort Order, Etc...
New SQL Server 2005 install (Stnd edition with SP2) and the Vendor for the Application Software has these requirements:

MS SQL Server SP2 with FULL Text Indexing and Natural Language Query. Collation SQL_Latin1_General_CPI_CI_AS; Date settings Month/Day/Year

When I installed SQL Server I basically installed the Default Collation of SQL_Latin1_General - is that different from their requirements???

Also, not sure about Natural Languarge Query AND the date settings??? is Natural Language Query installed by default and how do I check or change the Date Settings????

View Replies !
What Is Faster? C++ Vector Sort Or Sort In Database
hi there,I have to fetch values from a database and store them in a vector inmy c++ application.What is faster? if i fetch the values sorted from the database with a'order by' clause in the sql-statement or if i fetch them into thevector unsorted and sort the vector then?Thanx for your helpGreetzJens

View Replies !
Sort Order And Case Sensitivity
I have a query which filters records containing uppercase andLowercase i.e.Smith and SMITH, Henderson and HENDERSON etc.Is there a way that I can filter only those records that contain thefirst uppercase letter and the remaining lowercase letters for myquery i.e. Smith , HENDERSON etc.Thanks

View Replies !
Sort Order/Char Sets
Supposing I have a sort order/char set installed and some databases working under these circumstances.Is there any way to change order and sets without losing my old databases? If I try to rebuild databases, I lose them,and when i try to restore them, there's a conflict between the new SQL Server 6.5 configuration and the Databases previously created in old sort order/char sets?Is there any solution to this,or once I have chosen the database configurations,I'll have to either recreate the data or die with them??? Neede answers ASAP....

Thanks for your attention, Luciano

View Replies !
Performance With Respect To Sort Order ??
Hello Everyone!

Does anyone have experience regarding how the performance changes for changing sort order from binary to case insensitive?

Any help on this would be greatly appreciated.

Thanks!
- Manoj

View Replies !
SQL6.5 Sort Order, Need Urgent Help!!!!
Hi!

I just have one short question.
Is there a way to change the sort order in SQL 6.5 short of re-installing
the whole database?
If there is, how do I go about it?

TIA
Johan

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved