This is probably a simple question but I cant figure it out. I am trying to shorten some code by using a Do Loop. What I have are Fields names (Access DB) that are named Q1-Q20 and instead of writing the same code 20 times I am hoping to do something like this.
Dim rstIn As New...
I have to learn to pay attention to details....that worked out perfect.
I did have to change the last line -
and sdbache_stlev = '10'
to
where sdbache_stlev = '10'
but that was my typo.
Thanks again and here is a star
Thanks SQLDenis..
I tried to the isnull but since the row does not exists in the Hours Table...it skips over it.
I like the coalesce code...Never seen that before. Definitely will use that one day
Thanks
I have two tables...one SDBACHE and another Named Hours. Most records in SDBAHCE have a value in the table Hours...but there are a few records that dont.
The code above works great if I take out the
When (b.Hours_Earned) @@RowCount = 0 Then '02'
Wwhenever a row does not exists in the...
I am writing a case statement and need to add a value if the row count is 0 ...Here is my code
update A
Set SDBACHE_STLEV
= CASE
When (b.Hours_Earned) Between 0 and 27.990 Then '02'
When (b.Hours_Earned) @@RowCount = 0 Then '02'
When (b.Hours_Earned) Between 28 and 57.990 Then '03'
When...
This may not post as a good question because it may be to vague..but I will give it a shot...
I am trying to figure out some code that is in PL/SQL...In some of the sql statements that use
Select 'X' from dual where fieldname = :ID
what is Select X? I have tried this out...but it returns...
Thanks SQLDenis..I will give that code a shot and let you know...so far, i set it up like this and it worked out
Update EWS
SET ews_level
= CASE
When (Select hours_hours_earned from hours where hours_id = ews_id) Between 0 and 27.990 Then '01'
etc....
Else 'Something'
End
where ews_level =...
Thnaks for answering....
That update would work great if I was just using one table...but, I need to get the hours from a seperate table.
Any ideas..
Thanks
I am trying to update a table (EWS) by using a case statement. I am able to run this select statement
select A.EWS_ID, A.EWS_Level, b.Hours_hours_earned,
"NEW STUFF"
= CASE
When (b.Hours_hours_earned) Between 0 and 27.990 Then '01'
When (b.Hours_hours_earned) Between 28 and 57.990 Then '02'...
thanks...
the math is working but whenever I the decimal places are still in the field.
The reason I havn't changed to a int is because of the decimal places. The data is imported using a dts package. I think that I will change the field to a int and then multiply by 100 in the dts package...
I am trying to convert decimal numbers into a number without decimals…
Sample Data
Now Needs to Be
23.00 2300
68.67 6867
42.36 4236
All the decimals are two places.
I have used this sql statement to view the data
select table_hours, cast((table_hours * 100) as int) AS NewHours
From...
Thanks for the replies...
Geoka, I think the code would work great if I only had one ID, I did not mention in the orginal post that there are several different IDs. So, this code returns the max and min for the entire table. I think I will just use the two sql statements for now and take...
Thanks for responding…
I need to get the Max Activity Date (there are two dates that match 2003-02-13) and the Min Admit Date (which would be 200302 and not the 200303)
I could only do this using two statements…I imagine that there has to be a faster way
Thanks again
What I am trying to do is get the Max Activity Date and the min admit date.
Here is the Data...
ID Effect Date Admit Date Activity Date
17189 199603 199201 1997-04-14
17189 200303 200303 2003-02-13
17189 200302 200302 2003-02-13
17189 199503 199201 1995-11-15
17189 199201 199201 1995-11-15...
Thanks for inputs...I am sure that some arithmetic we be done on some of the fields but that will be on their end...I will leave it varchar and let them import it the way they need to...
thanks again
If this DB will be exported to a text file...then if I am thinking right, it will not matter if my data type is an integer or a varchar b/c the text file will have to be imported into their system.
Would anybody disagree with the above statement?
thanks and thanks for responding
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.