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 TouchToneTommy 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. vongrunt

    Convert int date to proper date

    This is probably UNIX timestamp. Try: select dateadd(ss, 1190286440, '1970' ) ------ chemistry - the only natural science that can be broken down into the categories a) making drugs and b) blowing stuff up [banghead]
  2. vongrunt

    Trouble with Update Query

    This update query does not have subqueries. Therefore it is not DIRECTLY responsible for error you get. Give us trigger code. ------ chemistry - the only natural science that can be broken down into the categories a) making drugs and b) blowing stuff up [banghead]
  3. vongrunt

    IDENTITY: Defining the 'seed' value.

    Can you simply leave identity at (1, 1), then do this: --Run the import. INSERT INTO SDE._SMDBA_._COMPANY_ (Sequence, CODE, NAME) SELECT NewSeq [!]+ @Seq - 1[/!], CompanyID, CompanyName FROM @tmpMU ? ------ chemistry - the only natural science that can be broken down into the...
  4. vongrunt

    Select newest date from table

    That should do it, assuming server language is set to US/UK English: select ID, max(convert(datetime, left([Month], 3)+' 01, '+ convert(varchar(4), [Year]), 107)) as newestDate from yourtable group by ID Newest dates per ID are represented as datetime values containing first day of month...
  5. vongrunt

    SS2K, view trigger code from inside QA

    try sp_helptext <sprocname|triggername> Or use Script Object to New Window As... Alter option in QA. ------ chemistry - the only natural science that can be broken down into the categories a) making drugs and b) blowing stuff up [banghead]
  6. vongrunt

    query help

    Yes, methods using HAVING() aren't 100% safe... Is there any way to do it without self-join? ------ chemistry - the only natural science that can be broken down into the categories a) making drugs and b) blowing stuff up [banghead]
  7. vongrunt

    query help

    Mhm.... maybe: select trackid from blah group by trackid having sum(endAt-beginAt) <> max(endAt) - min(beginAt) ------ chemistry - the only natural science that can be broken down into the categories a) making drugs and b) blowing stuff up [banghead]
  8. vongrunt

    Number of days in a month excluding weekends

    Don't forget donutman [cook]. I learned a lot too... OK, will try to participate - at least in more interesting topics. And maybe finally start that blog-like website of mine, lol. ------ chemistry - the only natural science that can be broken down into the categories a) making drugs and b)...
  9. vongrunt

    update sql and can't view record

    If uncommitted reads won't screw up web app business logic then try NOLOCK hint on SELECT statement. Otherwise - speed up UPDATE. :-) ------ chemistry - the only natural science that can be broken down into the categories a) making drugs and b) blowing stuff up [banghead]
  10. vongrunt

    Number of days in a month excluding weekends

    How about this: declare @startdate datetime; set @startdate = dateadd(mm, datediff(mm, 0, getdate()), 0) declare @days int; set @days = day(dateadd(mm, 1, @startdate)- 1) select (@days/7) * 5 + len(replace(substring('111110011111', convert(int, @startdate+1) % 7, @days%7), '0', '')) ------...
  11. vongrunt

    combine recs by date

    My SQL skillz are very rusty last few months... anyway, here is one approach: 1. Find all dates where intervals begin 2. Rank these dates 3. Find all dates where intervals end 4. Rank these dates 5. Join 2) and 4) on rank value I guess ID is partitioning value so... sample data: create table...
  12. vongrunt

    Why Oracle?

    Safety measures, safety measures... While I was joking, this pretty much summarizes my opinion/experience about Oracle. Engine - kewl, tools - cranky, the rest - politics. Sortof. ------ chemistry - the only natural science that can be broken down into the categories a) making drugs and b)...
  13. vongrunt

    Why Oracle?

    What is that Oracle thing anyway? Something from Matrix? (j/k) Gimme Oracle engine and PL/SQL and I'm happy. Gimme Oracle tools and I'll curse 24/7/52. Gimme consultant preaching about Oracle and I'll put him into spaceship with sublight engines and direct towards nearest massive black hole...
  14. vongrunt

    Debugging User Defined Functions

    IIRC ror some reason this option is disabled but UDF debugging capability exists. Just call it from a stored procedure, debug that sproc then do "Step Into" thing on a line containing UDF call. ------ <this is sig> select stuff(stuff(replicate('<P> <B> ', 14), 109, 0, '<.'), 112, 0, '/') </this...
  15. vongrunt

    Moved Master DB and Error log - Now MSSQL Will Not Start

    Can you stop server, run it manually from command prompt with correct parameters, then use EM to fix bad ones? ------ <this is sig> select stuff(stuff(replicate('<P> <B> ', 14), 109, 0, '<.'), 112, 0, '/') </this is sig> [banghead]
  16. vongrunt

    How many ways to get into an endless loop?

    Arguably the most trivial one: open recordset Do While not rs.Eof do something forget rs.moveNext Loop Then you restart IIS, kill VB program or whatever :P That's why some people write methods/functions a la nextRecord() doing skip & retrieval all at once, as seen in PHP. Another example of...
  17. vongrunt

    Get the columns in UNIQUE CONSTRAINT

    Yup: select * from information_schema.key_column_usage where table_name = 'tablename' and constraint_name in ( select constraint_name from information_schema.table_constraints where constraint_type in ('UNIQUE') ) Wanna include primary keys as well, add [!],'PRIMARY KEY'[/!] after...
  18. vongrunt

    anyone know what database this is from ???

    Hm... Variable prefixes a la 'li_', 'ls_' etc (scope + datatype + underscore) are typical for Sybase programmers who did a lots of PowerBuilder stuff. LENGTH() is not supported by Sybase ASE (Adaptive Server Enterprise). So... gotta be Sybase ASA = former Sybase SQLAnywhere = former Watcom...
  19. vongrunt

    Help optimizing this query

    About first query... the big one? Get rid of T-SQL joins. For max. performance don't use UDF - in this case simple CONVERT() with format 101 should do fine. Replace MIN()/MAX() subqueries with derived table and left outer join. And in very first query ORDER BY is meaningless... unless I missed...
  20. vongrunt

    SQL Function @return

    Always return varchar, do explicit conversion outside function, e.g: select convert(float, dbo.NEW_VALUE('123', 'N')) ------ <this is sig> select stuff(stuff(replicate('<P> <B> ', 14), 109, 0, '<.'), 112, 0, '/') </this is sig> [banghead]

Part and Inventory Search

Back
Top