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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recent content by jtammyg

  1. jtammyg

    again problem with multiple joins within a string...HELPPP!

    Hi! I tried printing @sql1 and it does not help: if exists (select [id] from master..sysobjects where [id] = OBJECT_ID ('master..temp_startime ')) DROP TABLE temp_startime declare @sql nvarchar(4000) declare @db varchar(300) set @db = 'master' declare cDB cursor for SELECT name...
  2. jtammyg

    again problem with multiple joins within a string...HELPPP!

    Hi LNBruno Thanks so much for your reply! how do u print the @sql? sorry I know is a stupid question. Thanks a lot!!!!!!!!!!!!!!!!! Tammy :-)
  3. jtammyg

    again problem with multiple joins within a string...HELPPP!

    here is the code: if exists (select [id] from master..sysobjects where [id] = OBJECT_ID ('master..temp_startime ')) DROP TABLE temp_startime declare @sql nvarchar(4000) declare @db varchar(300) set @db = 'master' declare cDB cursor for SELECT name from master..sysdatabases sdb WHERE...
  4. jtammyg

    join within a string?

    George, I already have found the problem. It was the one you pointed out AND '(cast(Sum(ff.length) as decimal)/1048576) as ''[Original File Size (MB)]''' + see the alias ff in length? Tammy
  5. jtammyg

    join within a string?

    SQLSister, It still gives me the error in the select statement. Any other ideas here? Can a join be done within the string or not? Thanks! Tammy
  6. jtammyg

    join within a string?

    hi! I am having an error Server: Msg 170, Level 15, State 1, Line 38 Line 38: Incorrect syntax near ' .dbo.filo_files b on a.[id] = b.ownerkey WHERE b.parentFileKey Is Null'. I don't see what is wrong. Maybe I cannot have a join in a string? The code is below. Thanks! --1) We are...
  7. jtammyg

    @set sql6 = need to put a join table in here...HELP!!!!

    Thank you so much! It's working now!!!!! That was a typo. :-) Tammy
  8. jtammyg

    @set sql6 = need to put a join table in here...HELP!!!!

    Hi Borislav! Sorry I meant to say there are selects within selects and they do not seem to work. This is the error message I get: Server: Msg 156, Level 15, State 1, Line 1 Incorrect syntax near the keyword 'from'. Server: Msg 156, Level 15, State 1, Line 1 Incorrect syntax near the keyword...
  9. jtammyg

    @set sql6 = need to put a join table in here...HELP!!!!

    hi! Im running the folowing code to loop through all the databases and insert the results in a temp table. In this case I need to run a join within a @sql string, but it does not work. Any ideas on how I can achieve this? Here is my code: if exists (select [id] from...
  10. jtammyg

    looping through all databases and executing a stored procedure while d

    Hi! I need to run my stored procedure on a monthly basis through all the databases and spit out a report in Excel. Here is my stored procedure for the report: CREATE PROCEDURE usp_DR_Billing (@StartDate datetime,@EndDate datetime,@PreviousDateEnd datetime) AS --insert all the...
  11. jtammyg

    how to do a sum product in sql server

    We need to group by hospital and hospital appears multiple times.
  12. jtammyg

    how to do a sum product in sql server

    The results of the multiplication only 0.244 0.254 26.7 After that is done I want to do the sum. Thank you! Tammy
  13. jtammyg

    how to do a sum product in sql server

    Thank you vongrunt...but the sum that way does not give me the result expected :( the sum of the parts etc etc...rule Thank you anyways! Tammy
  14. jtammyg

    how to do a sum product in sql server

    I need to do a sumproduct in SQL Server ALL_HOSPITALS table days percentage days avoidable 1 0.244 2 0.127 30 0.890 The calculation would be 0.244*1+0.127*2+0.890*30 The total of the above has to be divided by the sum of days. I am planning on having a temp table with the hosp name field and...
  15. jtammyg

    Evaluating an aggregate

    I need to do a sumproduct in SQL Server ALL_HOSPITALS table days percentage days avoidable 1 0.244 2 0.127 30 0.890 The calculation would be 0.244*1+0.127*2+0.890*30 The total of the above has to be divided by the sum...

Part and Inventory Search

Back
Top