Hi
I would be grateful for any help.
I need to divide a decimal field by another decimal field. These 2 fields (atick & amin) are set up as VARCHAR fields. I converted both of them as follows:
select cast (atick as decimal(10,9)) / cast(amin as decimal(10,9)) from mytable
BUT getting the...
Hi
I need to select records which were updated previous working day. This means if today is a Monday, I need to select records which were updated on Friday and not yesterday, which will be a Sunday.
I am using WHERE clause to get the previous day, but how can I do a selection whithin a WHERE...
I would be grateful for any help in the following:
1. I need to create additional records (probably using INSERT command) within a SELECT statement depending on a particular condition / situation. I normally use CASE statements within a SELECT statement to handle different conditions. The...
I need to caluculate Monthly (current) and Year-To-Date totals of the same value in the same query.
I am using SUM & GROUPBY commands with WHERE clause, this is working for monthly totals, but to have YTD totals I will need another WHERE clause.
I tried to have another SELECT, which is giving...
Could someone help me with the following:
I need to format numeric values with commas to separate hundreds, thousands, millions etc.
Could someone let me know how to do this please.
Many Thanks
Sivi
Claire
Thanks for your reply.
My requirement is to read a date from the user which will be inputted on the screen.
I normally do this in VB and send the inputted value as a parameter to a stored procedure in SQL.
But I want to read from the user on the screen from within SQL.
Thanks
Sivi
I would be grateful for any help in the following:
I need to read a date input from the user in SQL. This date will be used as a parameter in an SQL query.
Please someone could advice me on this.
If this is possible how this could be done.
Many Thanks
Sivi
I would be grateful for any help in the following:
1. I need to create additional records (probably using INSERT command) within a SELECT statement depending on a particular condition / situation. I normally use CASE statements within a SELECT statement to handle different conditions. The...
Tom, Sugarthan, James
Many thanks for your prompt reply & help. I tried distinct, group by (with MAX()). But unfortunately I did not get the results I want.
I think its due to the complexity of my query. 3 columns out of 4 are formatted (compound) columns using fields from various tables. Here...
My query has 5 output fields, combination of 4 of these fields has duplicate entries in the output.
I need to select only the unique combination of these 4 fields.
PLease could someone help me with this, how to select only the unique ones, any help will be grately appreciated.
Many thanks
Sivi
SQLBill Many thanks for your comments.
I tried the following:
variable1 = case when variable2 is NULL or cast(variable3 as decimal(10,9))=0.0 then ' ' else cast (variable2 as decimal(10,9)) / cast(variable3 as decimal(10,9)) end,
The error message is:
Arithmetic overflow error converting...
TLGsoft / SQLBill
Many thanks for your comments. IS NULL is very useful.
I am getting the following error message with the query statement:
variable1 = case when variable2 is NULL or cast(variable3 as decimal(6,5)) = 0.0 then ' ' else convert(decimal, variable2)/convert(decimal, variable3)...
I am trying to divide a decimal number by another decimal number.
I keep getting 'Divide by zero error encountered.' message.
The following is the statement.
The variables 2 & 3 are of varchar types, hence I am trying to convert them to decimal before the calculation.
variable1= case when...
Please could someone help me:
I need to find the last day of any month depending on month stored in the field.
For example the date value stored on the table is:
15032003
I need to find the last day of the month that is '31' for March using the month value '03' in this example. I need this...
I AM TRYING TO CONCATENATE 2 FIELDS, ONE IS HAVING DATA IN IT AND THE OTHER ONE IS 'NULL'. IN THE OUTPUT FIELD I WANT TO REPLACE 'NULL' WITH '0000'.
DATAFIELD 1 = '30001237'
DATAFIELD 2 = 'NULL'
I WANT TO CONCATENATE THE ABOVE 2 AND GET '300012370000'
PLEASE COULD SOMEONE HELP ME WITH THIS...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.