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 Chriss Miller 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: *

  1. zhavic

    problem with case in sql statement

    You should try something like this: SELECT ebbudd.budamt3 AS invoice, ebbudd.optional4 AS invoicenumber, exchangerate = CASE WHEN MAX( ebbudd.optional2 ) = 'AUD' THEN 1.0 WHEN COUNT(himsys.dbo.cscrd.rate) = 0 THEN 1.0 ELSE SUM(...
  2. zhavic

    Can one tell if a query is taking too long?

    Hi, for me this looks like the source of the problem: Clustered Index Update(OBJECT:([Anon].[dbo].[tbDVLACensus_Anonymised].[PK_tbDVLACensus_Anonymised_intDVLACensus_AnonymisedID]) Are you updating columns that are used in clustered index ? On that table with 36 milions rows it can take...
  3. zhavic

    Strange problem with return values of UDF in proc

    Can you post there your ADO statement ? Zhavic --------------------------------------------------------------- In the 1960s you needed the power of two Comodore64s to get a rocket to the moon. Now you need a machine which is a vast number of times more powerful just to run the most popular GUI.
  4. zhavic

    Quering Master and Transaction

    Try this select Table_Transaction.location, Table_Transaction.Item from Table_Transaction left join Table_Master on Table_Master.location = Table_Transaction.location AND Table_Master.itemno = Table_Transaction.itemno where Table_Master.location is null Zhavic...
  5. zhavic

    Problems Scheduling Import

    When you run that DTS package manually, are you running it directly from server machine or from another computer through Enterprise manager (for example) ? Zhavic --------------------------------------------------------------- In the 1960s you needed the power of two Comodore64s to get a...
  6. zhavic

    Query Help

    maybe I am missing something, but ... There SELECT Substring('<A href="http://www.domain.com/chem.asp?cId=' + CAST(chemicalId AS varchar) ... blah blah you have not FROM clause, so you are using columns from 'nowhere', for example column chemicalId I thing you need something like this...
  7. zhavic

    Complicated problem, and a difficult solution, Can Anyone Help?

    :-) I learned it at this forum ! Zhavic --------------------------------------------------------------- In the 1960s you needed the power of two Comodore64s to get a rocket to the moon. Now you need a machine which is a vast number of times more powerful just to run the most popular GUI.
  8. zhavic

    Simple SQL stored procedure example with table output parameter ?

    At first, create procedure that will return a table as result CREATE PROCEDURE usp_get_table AS ... blahblah ... -- create result ( SELECT statement without INTO clause ) SELECT some_field, some_another_field FROM some_table WHERE some_condition And this is how to use result...
  9. zhavic

    Complicated problem, and a difficult solution, Can Anyone Help?

    Hmmm, there is better way to write this procedure, This may be one of the ways, it shoving first part - building the CREATE TABLE statement. It does not using temp table and it using only one varriable to store the result in ( offcourse, there is also @job_id :-) ). Also it assumes that values...
  10. zhavic

    How to structure a nested loop/cursor

    You should create temporary column in your parent table to hold original ticked_id and after all, drop that column, e.g.: In the table dbo.tblDispatchTicket create one more column called previous_ticked_id Than do your insert into that table INSERT INTO dbo.tblDispatchTicket (all your...
  11. zhavic

    Dynamically build T-SQL for trigger

    :-) SET @flag = '''A''' Zhavic --------------------------------------------------------------- In the 1960s you needed the power of two Comodore64s to get a rocket to the moon. Now you need a machine which is a vast number of times more powerful just to run the most popular GUI.
  12. zhavic

    Remote Join Hint

    This is how I understand it: Let say you has local_table with 10 rows and remote_table with 1 milion rows. So if you use SELECT * FROM local_table A INNER REMOTE JOIN MyRemoteServer..remote_table B ON A.Col1 = B.Col1 than values...
  13. zhavic

    Difficult SQL Statement

    Hi, I am not sure, but let's say you has this rows in FlightPilot table FlightPilot table: flightId pilotid flightPilotAssignedTimestamp 10 12 5 15 12 21 14 25 13 7 12 6 3...
  14. zhavic

    Adding SQL line in to a Citrix - ODBC

    Hi, my english is poor but if you qwant to edit file 'hosts' you can try to experiment with system stored procedure xp_cmdshell - it execute any shell command - if you have permisions ( I am using SQL server 2000 ) Zhavic ---------------------------------------------------------------...
  15. zhavic

    Left Outer Join tune up...

    Hi m0nkey, can you post there more info about table 'repo_35' ? I was trying simulate your problem, having 87 milion rows in '[20054_dup]' table, 12K rows in 'avoid_areas' table and 0 rows in 'repo_35' table and query runs for a 1 second, but then I insert 800K rows in 'repo_35' table and quwry...
  16. zhavic

    Possible to declare a variable inside a select statement?

    Also to your original question. This way it will work, but it always be slower than one right written select stament DECLARE @myStr varchar(1000) SELECT @myStr = 'DECLARE @tmp INT SELECT @tmp = (SELECT B.test3 FROM B) SELECT A.test1, A.test2, CASE WHEN @tmp <> 0 THEN @tmp ELSE (SELECT...
  17. zhavic

    Possible to declare a variable inside a select statement?

    OK, At first, using subqueries in select list will always be slow. You should use this: SELECT A.test1, A.test2, Case When B.Test3 <> 0 Then B.Test3 Else C.Test4 End As MyResult FROM A CROSS JOIN ( SELECT MAX( Test3 ) AS Test3 FROM B ) AS B CROSS JOIN C Zhavic...
  18. zhavic

    Possible to declare a variable inside a select statement?

    Just do it this way: SELECT A.test1, A.test2, Case When B.Test3 <> 0 Then B.Test3 Else C.Test4 End As MyResult FROM A CROSS JOIN B CROSS JOIN C Zhavic --------------------------------------------------------------- In the 1960s you needed the power of two...
  19. zhavic

    Bug in SECONDS() ????

    I was encountered this problem long time ago running Win 98 SE and was looking for some answers and found that it is because of running FP 2.6 on multitasking OS. It will always do that errors with SECONDS() function. So you have to go different way. Zhavic...
  20. zhavic

    UNION Query: Error 8618

    At first, sorry for my english You have 2 SELECT statements and 2 GROUP BY statements, so the problem should be at second GROUP BY statement. But, based on Was anything on the server changed between a few weeks ago and now? and Not that I am aware of. I assume that GROUP BY clauses are OK...

Part and Inventory Search

Back
Top