I've imported a CSV file into my SQL server where it sits a table. All the datatypes are VARCHAR. There is 1 field that I would like to convert from VARCHAR ->>NUMERIC with 2 decimal places; "shtndamt1".
I have another field that I would like to group; "shslpnam". The table & column name is dbo.Sales_Header
The scerio is that I have multiple transactions by sales people where I would like to group them as a single entry per person. In addition, SUM the converted "shtndamt1".
I've made several attempts with the CONVERT parameter, but I'm missing something...Here is a variation of what I attempted and failed;
"SELECT shslpnam, SUM(Convert(decimal(16,8),
shtndamt1)) FROM dbo.Sales_Header GROUP BY shslpnam"
Part 1 of this is to get the SYNTAX correct for the SQL command, the other part is how to display the results in a table.
Thank you,
irwinpks
Start Free Trial