Showing posts with label swedish. Show all posts
Showing posts with label swedish. Show all posts

Thursday, March 8, 2012

"SELECT DISTINCT and ORDER BY"-problem

Hi!

I can't seem to get my query to work. It returns (translated from Swedish):

Microsoft JET Database Engine (0x80004005)
The ORDER BY-instruction (myDate)..."doesn't work with"...DISTINCT.

This is my query (somewhat simplified):

set rs=Server.CreateObject("ADODB.recordset")
sql="SELECT DISTINCT DATEPART(year, myDate) AS 'myColumn_alias' FROM myDB"
sql=sql & " WHERE myName='" & myName & "'"
sql=sql & " ORDER BY myColumn_alias"
rs.Open sql,conn

Is it because I have a WHERE-clause? If so, how should I design my query (I need only the years to populate a "select from" dropdownbox)? Or is it something else?

ThanksI don't think you can refer to a column alias the samw way you refer to a column.

Try:

ORDER BY DATEPART(year, myDate)|||I've tried that, but then I get the message that too few parameters are given and that 1 is expected.

:(|||All I had to do was to use YEAR(myDate) instead of DATEPART(year, myDate). Now it works!

Friday, January 27, 2012

"," (Comma) as Decimal Place - SQL SERVER 2000 /MSDE2000 does not work

Hi All,
If we change the System settings to Swedish(Finland), the decimal space is a
Comma "," instead of a Dot "." Now the problem is SQL Server does not
recognize this and gives error. We can not do collation setting for numeric
fields also.
Any help on the same will be highly appreciated.
Regards
Rajib
SQL Server is not affected by regional settings. You have to give him dots
only.
There is no such thing like "collation setting for numeric fields".
Please read more about collations.
Bojidar Alexandrov
"Rajib Chatterjee" <rajibc@.hotmail.com> wrote in message
news:OpHbNuZXEHA.1888@.TK2MSFTNGP11.phx.gbl...
> Hi All,
> If we change the System settings to Swedish(Finland), the decimal space is
a
> Comma "," instead of a Dot "." Now the problem is SQL Server does not
> recognize this and gives error. We can not do collation setting for
numeric
> fields also.
> Any help on the same will be highly appreciated.
> Regards
> Rajib
>
>
|||SQL Server is not affected by regional settings. You have to give him dots
only.
There is no such thing like "collation setting for numeric fields".
Please read more about collations.
Bojidar Alexandrov
"Rajib Chatterjee" <rajibc@.hotmail.com> wrote in message
news:OpHbNuZXEHA.1888@.TK2MSFTNGP11.phx.gbl...
> Hi All,
> If we change the System settings to Swedish(Finland), the decimal space is
a
> Comma "," instead of a Dot "." Now the problem is SQL Server does not
> recognize this and gives error. We can not do collation setting for
numeric
> fields also.
> Any help on the same will be highly appreciated.
> Regards
> Rajib
>
>

"," (Comma) as Decimal Place - SQL SERVER 2000 /MSDE2000 does not work

Hi All,
If we change the System settings to Swedish(Finland), the decimal space is a
Comma "," instead of a Dot "." Now the problem is SQL Server does not
recognize this and gives error. We can not do collation setting for numeric
fields also.
Any help on the same will be highly appreciated.
Regards
RajibSQL Server is not affected by regional settings. You have to give him dots
only.
There is no such thing like "collation setting for numeric fields".
Please read more about collations.
Bojidar Alexandrov
"Rajib Chatterjee" <rajibc@.hotmail.com> wrote in message
news:OpHbNuZXEHA.1888@.TK2MSFTNGP11.phx.gbl...
> Hi All,
> If we change the System settings to Swedish(Finland), the decimal space is
a
> Comma "," instead of a Dot "." Now the problem is SQL Server does not
> recognize this and gives error. We can not do collation setting for
numeric
> fields also.
> Any help on the same will be highly appreciated.
> Regards
> Rajib
>
>

"," (Comma) as Decimal Place - SQL SERVER 2000 /MSDE2000 does not work

Hi All,
If we change the System settings to Swedish(Finland), the decimal space is a
Comma "," instead of a Dot "." Now the problem is SQL Server does not
recognize this and gives error. We can not do collation setting for numeric
fields also.
Any help on the same will be highly appreciated.
Regards
RajibSQL Server is not affected by regional settings. You have to give him dots
only.
There is no such thing like "collation setting for numeric fields".
Please read more about collations.
Bojidar Alexandrov
"Rajib Chatterjee" <rajibc@.hotmail.com> wrote in message
news:OpHbNuZXEHA.1888@.TK2MSFTNGP11.phx.gbl...
> Hi All,
> If we change the System settings to Swedish(Finland), the decimal space is
a
> Comma "," instead of a Dot "." Now the problem is SQL Server does not
> recognize this and gives error. We can not do collation setting for
numeric
> fields also.
> Any help on the same will be highly appreciated.
> Regards
> Rajib
>
>

change the System settings to Swedish(Finland), the decimal space is a Comma

Hi All,
If we change the System settings to Swedish(Finland), the decimal space is a Comma "," instead of a Dot "." Now the problem is SQL Server does not recognize this and gives error. We can not do collation setting for numeric fields also.
Any help on the same will be highly appreciated.
RegardsSQL Server is not affected by regional settings. You have to give him dots
only.
There is no such thing like "collation setting for numeric fields".
Please read more about collations.
Bojidar Alexandrov
"Rajib Chatterjee" <rajibc@.hotmail.com> wrote in message
news:OpHbNuZXEHA.1888@.TK2MSFTNGP11.phx.gbl...
> Hi All,
> If we change the System settings to Swedish(Finland), the decimal space is
a
> Comma "," instead of a Dot "." Now the problem is SQL Server does not
> recognize this and gives error. We can not do collation setting for
numeric
> fields also.
> Any help on the same will be highly appreciated.
> Regards
> Rajib
>
>
|||SQL Server is not affected by regional settings. You have to give him dots
only.
There is no such thing like "collation setting for numeric fields".
Please read more about collations.
Bojidar Alexandrov
"Rajib Chatterjee" <rajibc@.hotmail.com> wrote in message
news:OpHbNuZXEHA.1888@.TK2MSFTNGP11.phx.gbl...
> Hi All,
> If we change the System settings to Swedish(Finland), the decimal space is
a
> Comma "," instead of a Dot "." Now the problem is SQL Server does not
> recognize this and gives error. We can not do collation setting for
numeric
> fields also.
> Any help on the same will be highly appreciated.
> Regards
> Rajib
>
>