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: NotSQL
  • Order by date
  1. NotSQL

    SQL Sytax

    Hi Guys, I have a bit of SQL which stores information into temp tables however I’m sure there is a better way of do this. Any help or suggestions would be grateful. SELECT * INTO #EMAIL FROM KeyCareClean WHERE NOT EXISTS (select * from STUDENT where...
  2. NotSQL

    Store Procedure

    Just to add to this i've just broken up the store procedure to on run the first part Declare @Year_Local varchar(4) = '2010', @Quarter_Local varchar(9)= null, @Month_Local varchar(3)=null, @Silo_Local varchar(2) = null Select Person_name, MaginusAccount, Account_Name, 'Person Target...
  3. NotSQL

    Store Procedure

    Hi, Im having issues with the performance of this store procedure. does anyone have any ideas how i might improve it? Declare @Year_Local varchar(4), @Quarter_Local varchar(9), @Month_Local varchar(3), @Silo_Local varchar(2) --VisitedTargetedSiloAccounts Select Person_name...
  4. NotSQL

    query optimization

    Can any one suggest how i might improve the performance of this store procedure? It seem to take a while to run and im sure there is a better way of writing it... Declare @Year_Local varchar(4), @Quarter_Local varchar(9), @Month_Local varchar(3), @Person_name_Local varchar(100) Select...
  5. NotSQL

    Query help

    Anyone got any ideas on how i might get the above working. I want the bottome where clause to be a parameter so the user can type either visited or not visited Cheers
  6. NotSQL

    Query help

    SQL Server 2008R2..... I only require the the records from t1
  7. NotSQL

    Query help

    I was just wondering if this was the best way to write the query...
  8. NotSQL

    Query help

    bborissov, this still isnt working, even with NumberOfMeetings..... it states its a invalid column.....
  9. NotSQL

    Query help

    I've written this query, however im not sure it the best way to write it. Could someone please help? Thanks in advance Select t1.* From (Select Silo,Arrow_Silo_Name, AccountName,Account_Name From Sales_Matrix inner join Arrow_Silo_Description on Sales_Matrix.Silo =...
  10. NotSQL

    Query help

    Thanks bborissov, however i've just tested the query and it doesnt seem to work.. It complains about the column NumberOFMeeting
  11. NotSQL

    Query help

    Hi Guys, I have this query below: It works fine however i'd like to use Where t2.NumberOFMeeting = 'Not visited' in the where clause instead of: where t2.NumberOFMeeting is null any help would be appreciated Declare @Year varchar(4) = 2010, @Quarter varchar(9) = null, @Month varchar(3) =...
  12. NotSQL

    GOTO

    Thanks for all this very useful information gmmastros...
  13. NotSQL

    GOTO

    I've created a store procedure using this information however when i try and run the procedure in the form of EXEC Storeprocedure '2010'. It states it requires the @Quarter parameter Any ideas? ALTER PROCEDURE [dbo].[Report_1_Visits_by_Targeted_and_Un-Targeted] -- Add the parameters for the...
  14. NotSQL

    Query

    This is what im try to get to, is this the best way of writting this? Select t1.AccountName, IsNull(t2.NumberOFMeeting,0) as NumberOFMeeting From (Select AccountName From Sales_Matrix Group By AccountName)t1 left outer join (Select MaginusAccount, ISNULL(Count(AccountName),0) As...
  15. NotSQL

    GOTO

    Thanks, that is realy useful information So Would you recommend the fist option as the best option...?
  16. NotSQL

    Query

    Sorry to bother you all again. Im trying to join these two queries together, can you help. I need all the accounts in query one and a count of meetings that have have taken place which are in query two... I know i need to join on accountName but am unsure how to join the 2 queies Select...
  17. NotSQL

    GOTO

    Yeah please assist if you believe there is a better way
  18. NotSQL

    GOTO

    Can you help me with this GOTO statement Declare @Year varchar(4) = '2010', @Quarter varchar(9) = null, @Month varchar(3) = Null If @Quarter = null and @Month = null GOTO Step_One; Else GOTO Step_Four; Step_One: SELECT 'StepOne', CASE Targeted_Account WHEN 'TRUE' THEN 'Targeted' ELSE...
  19. NotSQL

    Syntax

    Hi Guys,I've been given a task to rewirte a bit of SQL and was wondering if you could help me out. The bit of sql below takesa while to run so any help would be greatful. select NET_AMOUNT,UNIT_AMOUNT,QUANTITY,to_Char(PRO_ID) as ProID,to_Char(PER_ID) as PerID,to_Char(MEM_ID) as MEM_ID from...
  20. NotSQL

    SQL

    Ahh Sorry, no its Oracle.. Ill repost it in a oracle forum

Part and Inventory Search

Back
Top