Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  • Users: sivi
  • Order by date
  1. sivi

    Dividing decimal by decimal in SQL

    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...
  2. sivi

    making a choice in where clause statement

    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...
  3. sivi

    SQL Server - Using INSERT command within SELECT, for any conditions

    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...
  4. sivi

    SQL - Calculating Monthly and Year-To-Date totals in the same query

    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...
  5. sivi

    How to format numbers (int) to separate hundreds, thousands etc with c

    Thanks Matt, pascalsql and fluteplr. I have gone for Matt's solution as I have to do this in SQL Server. Sivi
  6. sivi

    How to format numbers (int) to separate hundreds, thousands etc with c

    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
  7. sivi

    Creating an input prompt in SQL Server

    pascalsql, SQLBill Many thanks for your comments. Our interface is vb, but SQLBill's suggestion will help the situation. Sivi
  8. sivi

    Creating an input prompt in SQL Server

    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
  9. sivi

    Creating an input prompt in SQL Server

    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
  10. sivi

    I would be grateful for any help in

    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...
  11. sivi

    Help on SQL Server - Selecting only the unique records

    I had some test fields in the query. Thats why DISTINCT was not working. Its OK now. Thanks again Sivi
  12. sivi

    Help on SQL Server - Selecting only the unique records

    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...
  13. sivi

    Help on SQL Server - Selecting only the unique records

    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
  14. sivi

    dividing decimal number by decimal number in SQL server

    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...
  15. sivi

    dividing decimal number by decimal number in SQL server

    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)...
  16. sivi

    dividing decimal number by decimal number in SQL server

    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...
  17. sivi

    SQL Server Dates - finding the last day of the month.

    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...
  18. sivi

    concatenating null & non-null values

    Maria Thanks for this. It worked for fine Sivi
  19. sivi

    concatenating null & non-null values

    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...
  20. sivi

    Finding the length of the data field on a SQL table

    Terry Thanks for your help. I hope to get it working. Sivi

Part and Inventory Search

Back
Top