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

  1. iker3000

    query within a query??

    Hi! This might be a bit faster then using a subquery: SELECT docnumber, version FROM Documnets LEFT OUTER JOIN (SELECT docnumber FROM Documents WHERE Version = 1) AS Version_1 ON Documents.docnumber = Version_1.docnumber WHERE Version_1.docnumber IS NULL OR...
  2. iker3000

    using a user defined function to validate data

    Hi! The Code in the answer would return OK For the following string: 'a123.234' because 123.234 is numeric. I would suggest the following sollution: CREATE FUNCTION dbo.CheckForOrderID (@vc1 VARCHAR(50)) RETURNS varchar(50) AS BEGIN DECLARE @okStatus varchar (50) DECLARE...
  3. iker3000

    select ... from sProc

    Hi! You can't do that. Instead of that you can create a temp table, insert the result in this one (INSERT INTO #table_name EXEC your_stored_procedure) and than work with this (I'm not sure but I think, that you can't use a table varieble in this place instead of the temp table). However you...
  4. iker3000

    Function doesn't accept expression as param

    That's why I wrot LIKE '%,'+ + ',%' (because the commas make it unique)
  5. iker3000

    select query help

    Hi! Change the to inner joins to LEFT OUTER JOINs (I assume, that there is no row in tbl_Production for Employees who have not worked and, there is no rows in trainingtable for Employees who have not been trained). Iker
  6. iker3000

    Getting the result set from a stored procedure

    CREATE TABLE #Result_table( ... like your result set ) INSERT INTO #Result_table EXEC your_stroed_procedure paramter1, paremter2, ... Iker
  7. iker3000

    Function doesn't accept expression as param

    Would this give the desired result? SELECT st.Item_Id, st.Item_Name, st.Quantity, st.Sale_Price, st.Quantity * st.Sale_Price as Value, cast(sd.Department_Name as varchar(5)) + ' %' as Comission, st.Quantity * st.Sale_Price * (cast(sd.Department_Name as int)) / 100 as...
  8. iker3000

    Function doesn't accept expression as param

    Could you give a short explanation what your selct is trying to do? dos si has only one row? Why are your tables not joined in any way? Your where clause could also be stated putting this into the from part of the sellect: Store_Dept sd INNER JOIN Store_Items si ON...
  9. iker3000

    AS/400 questions At our company

    Hi! I'm sorry, but I don't know the exact version of AS400 we are running. The thing is, that the IT department plans to buy a new server because we can't use the existing one (which has more then one processors), at least that's what they say). Because we can only use one processor (??????) we...
  10. iker3000

    Timeout Expierd

    If you have a problem with the script running faste in query analyser than in your application, have a look at disconnected recordsets. ADO can get very slow if your recordset is connected. IKER
  11. iker3000

    AS/400 questions At our company

    AS/400 questions At our company we are using AS/400 Servers for keeping record of our customer data. In the last period we had many problems, and I couldn't get clear answer from the IT department why. I am not realy experienced with big systems (I am more comfortable with Windows based systems...
  12. iker3000

    holding the lastupdateddate time of a particular record

    Try using a trigger, but be careful, updateting the table wich caused the trigger to run can cause the trigger to run again. Look at what recursive triggers are and how to avoig refiring the trigger. In the trigger you will have an Inserted object which contains al the inserted a modified...
  13. iker3000

    SQL Query

    Do you have a minimal and maximal size for numbers? Ho big is your table (not very big). Are they only int-s in your table? If so, I now a not very dificult but easy way: You create a table with one column containing numbers form max value to min value (for example 1 ... 100) - Numbers Lets...
  14. iker3000

    Temp DB locking prob

    Try these selects. I found that an inner join is alway a better solution then everything else (especialy if you have some indexes defined on the given columns) SELECT jobid FROM INVSwitchTransvalidtbl INNER JOIN (SELECT DISTINCT JobID FROM INVJobsTbl WHERE periodid = 23) AS...
  15. iker3000

    encrypt pword in tables

    Hi! What type of program do you need the passwords for (what kind of languege)? Maybe you should consider to build the encryption into your client, and save the password encrypted. If the user enters his password at the client, you only have to encrypt it and compare it with the saved value...
  16. iker3000

    A Crosstab unlike others...

    Hi! You have a big problem: there is nothing like crosstab query in MS-SQL. If you want to make something like this, you will have to build it dynamicaly (except you have a given number of column headers). This is not very easy, you have to build a Cursor on a select returning the different...
  17. iker3000

    Get a value from MAX row

    SELECT stquem.product, AVG(stquem.unit_cost) FROM stquem INNER JOIN (SELECT product, MAX(date_received) AS date_received, FROM stquem GROUP BY product) AS Max_date_table ON Max_date_table.product = stquem.product AND Max_date_table.date_received =...
  18. iker3000

    Re-ordering SP results by column

    A permanent table is a bad idea if you have many users (many-many at the same time) and many records. However the above given example can handle some users (with some thousend of records/report) with ONE permanent table without any problem, and you don't have to mess around with ASP. IKER
  19. iker3000

    using the IN statement

    Look for the t-sql refference of IN and LIKE in SQL-help or on the internet: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnanchor/html/sqlserver2000.asp IKER
  20. iker3000

    SELECT statement - select first entry in day

    Hi! I think the following, more complicated code would be more efficient. SELECT Table_1.User, Time, .... FROM Table_1 INNER JOIN (SELECT User, MAX(Time) AS Time FROM Table_1 GROUP BY PRODUCT) AS Max_time_table ON Max_time_table.User = Table_1.User AND...

Part and Inventory Search

Back
Top