I have the following sql and trying to convert the hard code fields (tran_type and flag) to integer. These are currently resulting as text fields. Can someone advise how? Tried to put a cast around it, but it keeps giving me a syntax error.
select
'0' as 'tran_type',
'1' as 'flag',
tradedate...
Trying to write a query to pull all products expiring in the next 7 days. I have an expiredate column and the date is in format (yyyy-dd-mm + timestamp). Need to pull any dates = today or within 7 days. Timestamp is always 00:00:00.00. Please help!
I am using a variable set by the user to insert multiple rows into a table leveraging values from another table.
Insert into TableA (code, type)
values (@code, type)
The type value is from another table, but I want to insert a row in TAble A for each Type existing in Table B. So if 5...
Hi,
I am trying to set up a massive query with many joins and case statements. I'm noticing that my results are duplicating and can see why, but not sure the best way to fix it.
To simplify it, let's say I have two tables. Table A is orders and Table B is sub-orders. Table A doesn't have...
Hi,
I am trying to use multiple case statements based on the manager code selected. Depending on the manager code, I need to check the holdings and trade tables. If the symbol exists in either the holdings or trades table, default that strategy, else default "NEW_STRAT". Im not sure what the...
Hi,
I am trying to send an email with query results in the text message. The query I am running is rather large but it seems to be having a problem with the values. I am able to run the proc with a simple select * from table statement but when I insert a value I get an incorrect syntax error...
Hi,
I am trying to return multiple values using select/case statements and include those values in a text message and send via sql mail.
The table will display which jobs have ran via codes. I want to gather all the codes that ran today and substitute the codes with a different value...
Thanks all. Can you also help me figure out how to return multiple values but using a case statement substitute those values with another value. i.e. if codes A and C were run today, i want to be able to substitute Apple for A and Cat for C and output:
The following reports were output today...
Hi,
I'm really new to SQL. I am trying to set up a query that runs automatically daily to pull any data populated in a table for the present day (not just for today but ongoing daily). I do not want to have to have to update the date in the query daily. The table only populates with codes of...
i am a fairly new access user and need to break down a date field set up like this: 06/27/02 INTO 2 fields: 'fiscal year' and 'fiscal month'
How do i query the data to read the '06' in the date field and return it into the fiscal month field as '09'? and how do make it read the '02' and return...
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.