Showing posts with label cant. Show all posts
Showing posts with label cant. Show all posts

Tuesday, March 27, 2012

CONCAT function + SQL Sever 2005

I cant find a clear answer to the syntax of concat in for SQL 2005. Can anyone help.it's still the same old plus sign|||I figured out what I was doing wrong. I used text as my data type for the two fields I was trying to CONCAT. So when I did First_name + ' ' + Last_name is was treating the two columns as text and the blank space as a varchar. So i would execute.|||don't use the text type for such small fields as first and last names. text is for big blobs of text longer than 8000 chars. I don't know anyone with such a long name. :)

and in 2005, don't use text at all. use varchar(max) or nvarchar(max).

Monday, March 19, 2012

Componente Services + win xp sp2

Hi.
I've intalled windows xp service pack 2, since there I cant' view Component
Services -> Transaction Statistics from a remote server.
I'm not using XP Firewall.
Any ideia?
Thanks
EsioI found the problem...
RPC changed.
http://msdn.microsoft.com/security/productinfo/XPSP2/networkprotection/restrict_remote_clients.aspx
Esio
"Esio Nunes" <esio_nunes@.hotmail.com> escreveu na mensagem
news:uznYoqk%23EHA.4092@.TK2MSFTNGP09.phx.gbl...
> Hi.
> I've intalled windows xp service pack 2, since there I cant' view
> Component Services -> Transaction Statistics from a remote server.
> I'm not using XP Firewall.
> Any ideia?
> Thanks
> Esio
>

Componente Services + win xp sp2

Hi.
I've intalled Windows XP service pack 2, since there I cant' view Component
Services -> Transaction Statistics from a remote server.
I'm not using XP Firewall.
Any ideia?
Thanks
EsioI found the problem...
RPC changed.
http://msdn.microsoft.com/security/...te_clients.aspx
Esio
"Esio Nunes" <esio_nunes@.hotmail.com> escreveu na mensagem
news:uznYoqk%23EHA.4092@.TK2MSFTNGP09.phx.gbl...
> Hi.
> I've intalled Windows XP service pack 2, since there I cant' view
> Component Services -> Transaction Statistics from a remote server.
> I'm not using XP Firewall.
> Any ideia?
> Thanks
> Esio
>

Thursday, March 8, 2012

COMPLEX sql query PLEASE HELP!

I cant get "order by" to work in this sql query..
I use this query:

"SELECT DISTINCT TOP 12 name,total = COUNT(*) FROM products where kat = 'music' group by namn"
and I want to add this some where to get 12 random records: "ORDER BY NewID()"

I tried this:"SELECT DISTINCT TOP 12 name,total = COUNT(*) FROM products where kat = 'music' group by namn ORDER BY NewID()""
but get the error:
"ORDER BY items must appear in the select list if SELECT DISTINCT is specified"

I can′t figure out how I should write the query..
Somebody have any ideas??
/Radiwoi

Try something like this:
SELECT TOP 12 name, total FROM (SELECT name, total = COUNT(*) FROM products WHERE kat = 'music' GROUP BY name) AS groupedSet ORDER BY NEWID()

The subquery generates a set in the output format that you want, the main query just orders it randomly and restricts it to 12 rows.

Does this help?
|||Thanks for your answer and thanks for your help It worked perfect.
you are KING!!!