Advertisement

04.16.2008 at 09:03AM PDT, ID: 23327723
[x]
Attachment Details

How to convert varchar ->>numeric using SQL command w/Vbscript response.write

Asked by irwinpks in MS SQL Server, Active Server Pages (ASP), VB Script

Tags: Microsoft, SQL, 2000

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,

irwinpksStart Free Trial
[+][-]04.16.2008 at 09:39AM PDT, ID: 21369665

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.16.2008 at 11:33AM PDT, ID: 21370662

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.16.2008 at 01:42PM PDT, ID: 21371773

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.16.2008 at 01:43PM PDT, ID: 21371780

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.16.2008 at 01:56PM PDT, ID: 21371883

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.16.2008 at 02:04PM PDT, ID: 21371947

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.16.2008 at 02:18PM PDT, ID: 21372063

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.16.2008 at 02:55PM PDT, ID: 21372367

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.16.2008 at 03:25PM PDT, ID: 21372584

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.16.2008 at 06:11PM PDT, ID: 21373330

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: MS SQL Server, Active Server Pages (ASP), VB Script
Tags: Microsoft, SQL, 2000
Sign Up Now!
Solution Provided By: ee_rlee
Participating Experts: 4
Solution Grade: A
 
 
[+][-]04.16.2008 at 06:14PM PDT, ID: 21373347

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628