•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the MS SQL section within the Web Development category of DaniWeb, a massive community of 391,985 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,227 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MS SQL advertiser:
Views: 579 | Replies: 5
![]() |
•
•
Join Date: May 2008
Posts: 3
Reputation:
Rep Power: 0
Solved Threads: 0
if i use the query
it works just fine.. but in this case the dt (date) field is not recognised..
Can anyone see what's wrong?
thanks a lot for your help
SELECT iditem, CONVERT(char(20), dt, 105) FROM planeamento
it works just fine.. but in this case the dt (date) field is not recognised..
SELECT planeamento.iditem, idmodelo, item_planeamento.idproduto, item_planeamento.idpele, cor, ordemfabrico, qtd, CONVERT(char(20), dt, 105) FROM produto INNER JOIN item_planeamento ON produto.idproduto = item_planeamento.idproduto INNER JOIN planeamento ON item_planeamento.iditem = planeamento.iditem WHERE planeamento.idfabrica = 51 AND alterado = 'FALSE' AND estado = NULL GROUP BY planeamento.iditem, produto.idModelo, item_planeamento.idProduto, item_planeamento.idPele, item_planeamento.cor, item_planeamento.ordemFabrico, item_planeamento.qtd, planeamento.dt
Can anyone see what's wrong?
thanks a lot for your help
•
•
Join Date: Aug 2005
Location: near St Louis, Missouri, USA
Posts: 10,561
Reputation:
Rep Power: 36
Solved Threads: 860
It doesn't work because planeamento table is not in the FROM clause. Correct the query by specifying the planeamento as you did in other places
CONVERT(char(20), planeamento.dt, 105) Last edited by Ancient Dragon : May 26th, 2008 at 10:11 am.
I think it's about time we voted for senators with breasts. After all, we've been voting for boobs long enough. ~Clarie Sargent, Arizona senatorial candidate
Those who are too smart to engage in politics are punished by being governed by those who are dumber. ~Plato
Those who are too smart to engage in politics are punished by being governed by those who are dumber. ~Plato
•
•
Join Date: May 2008
Posts: 3
Reputation:
Rep Power: 0
Solved Threads: 0
hum, but my previous query was the same but without the convert, so, was just
SELECT planeamento.iditem, idmodelo, item_planeamento.idproduto, item_planeamento.idpele, cor, ordemfabrico, qtd, DT FROM .......
and it printed the dt fine, but int the wrong format, that's why i am trying to convert it.. i assumed that if dt prints well, why don't the convert works? i tried like you said:
but was the same..
thanks for your help!
SELECT planeamento.iditem, idmodelo, item_planeamento.idproduto, item_planeamento.idpele, cor, ordemfabrico, qtd, DT FROM .......
and it printed the dt fine, but int the wrong format, that's why i am trying to convert it.. i assumed that if dt prints well, why don't the convert works? i tried like you said:
CONVERT(char(20), planeamento.dt, 105)
but was the same..
thanks for your help!
Last edited by Porsche.V : May 26th, 2008 at 10:38 am.
•
•
Join Date: Aug 2005
Location: near St Louis, Missouri, USA
Posts: 10,561
Reputation:
Rep Power: 36
Solved Threads: 860
>>but was the same..
You mean the convert was the same as without convert? If that is true then the 105 must be the wrong format specifier. I don't have the books so you will have to look up the format you want.
You mean the convert was the same as without convert? If that is true then the 105 must be the wrong format specifier. I don't have the books so you will have to look up the format you want.
I think it's about time we voted for senators with breasts. After all, we've been voting for boobs long enough. ~Clarie Sargent, Arizona senatorial candidate
Those who are too smart to engage in politics are punished by being governed by those who are dumber. ~Plato
Those who are too smart to engage in politics are punished by being governed by those who are dumber. ~Plato
•
•
Join Date: May 2008
Posts: 3
Reputation:
Rep Power: 0
Solved Threads: 0
just found the problem.. i needed
everything was correct but i wasn't "giving" a name to the column i was converting
thanks a lot for your help
CONVERT(char(20), planeamento.dt, 105) AS dt
everything was correct but i wasn't "giving" a name to the column i was converting
thanks a lot for your help
•
•
Join Date: Apr 2008
Posts: 295
Reputation:
Rep Power: 1
Solved Threads: 41
•
•
•
•
if i use the querySELECT iditem, CONVERT(char(20), dt, 105) FROM planeamento
it works just fine.. but in this case the dt (date) field is not recognised..
SELECT planeamento.iditem, idmodelo, item_planeamento.idproduto, item_planeamento.idpele, cor, ordemfabrico, qtd, CONVERT(char(20), dt, 105) FROM produto INNER JOIN item_planeamento ON produto.idproduto = item_planeamento.idproduto INNER JOIN planeamento ON item_planeamento.iditem = planeamento.iditem WHERE planeamento.idfabrica = 51 AND alterado = 'FALSE' AND estado = NULL GROUP BY planeamento.iditem, produto.idModelo, item_planeamento.idProduto, item_planeamento.idPele, item_planeamento.cor, item_planeamento.ordemFabrico, item_planeamento.qtd, planeamento.dt
Can anyone see what's wrong?
thanks a lot for your help
Hi Porsch
You are joining various tables. Are you sure that dt exists only in table planeamento? If not, dt must be qualified (as like as in group-by clause: planeamento.dt).
krs,
tesu
Last edited by tesuji : May 26th, 2008 at 12:49 pm.
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb MS SQL Marketplace
•
•
•
•
access advice broadband business classification code combo crime cult of the dead cow daniweb data data protection data transfer database drive dropdownlist encryption europe forensic forensics gadget google government hacking hard hardware help hitachi hp industrial espionage information internet linux mobile module net news payment services privacy protection reuse search security spot storage terabyte tutorials and more tv web wikipedia
- getline failing to read from data file? (C++)
- Bitwise: Convert Primitives (Java)
- help me to read my data file:(( (C)
- String to char* conversion (C++)
- need a little guidance (Java)
- OOP char [8] to char (C++)
- adding data into an char array (C++)
- Fast data storage (C++)
Other Threads in the MS SQL Forum
- Previous Thread: how to create database for business site containing no of subcategories
- Next Thread: Need help ordering records



Linear Mode