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 bkrike 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 grahamm

  1. grahamm

    Erroor with execute of insert sp

    Stored procedures can be multistep. I noticed that you have a rollback transaction, but no begin transaction. Assuming that the sp is a self contained transaction you should alter your sp to include a begin transaction create procedure ...... as begin transaction insert ... if ...
  2. grahamm

    Importing Text File To Sql Server

    I suspect that somewhere in your 31,000 records column 32 has a character string that can not be parsed as an integer number. When you let DTS create the table I would guess that it has built the table with a type of char (or varchar) for col 32. Given that you can load a portion of the file...
  3. grahamm

    subquery null problem

    I'm glad to help... :-)
  4. grahamm

    subquery null problem

    Ok agreed.. while column = NULL or column = @v (where @v is NULL) evals to TRUE columnA = columnB evals to FALSE when both are null. See also http://support.microsoft.com/support/kb/articles/Q214/6/01.ASP The workaround would be insert into...
  5. grahamm

    subquery null problem

    I'm not sure I understand your expectation:- With set ansii_nulls off are you expecting: siteid=#TempItems.SiteID to evaluate to true if siteid is null and #TempItems.SiteID is not null?
  6. grahamm

    Transaction Logs full--Need to Shrink ASAP

    1) Start query analyser. You should find it under: Start-> Programs -> MS SQL Server 7.0 -> Query Analyzer 2) Connect to your SQL Server, 3) If your database is called foo type:- dbcc shrinkdatabase (foo, notruncate) However if you need SQL Server to release the space back to the file...
  7. grahamm

    subquery null problem

    How about trying:- insert into [stats](StatDate,SiteID,SiteName,StatType,UniqueHits,TotalHits,JoinHits) select *, JoinHits = (select count(*) from referer where refdirection='OUT' and RefType=#TempItems.StatType and refdate=#TempItems.StatDate and (siteid=#TempItems.SiteID or siteid is NULL)...
  8. grahamm

    IF STATEMENT ON A SELECT?

    If you're talking about T-SQL in a stored procedure thenyou can use the builtin @@rowcount variable: select ... from ... where if @@rowcount=0 begin print "No Records Matched" return end
  9. grahamm

    SQL Server Data type problem. Syntax error...

    In this situation implicit conversion is not performed. In other circumstances such as passing a smallint variable to a stored procedure integer parameter, implicit conversion is performed. Take a look at "Data Type Conversion" in the BOL. Also you can use either CONVERT or CAST.
  10. grahamm

    Currency handling..?

    If you can add an entry to the source table for SEK e.g. Date Currency Currency_Rate 1 DKK 1,2 1 EUR 7,8 1 SEK 1,0 then a non-equi join will do it: select a.date, a.code,b.code, a.rate/b.rate from exchange a ,exchange b where a.code <> b.code If...
  11. grahamm

    SQL Server Data type problem. Syntax error...

    Looks like @PaymentTypeCode is the problem. Change: SET @Payment_Types_XML = @Payment_Types_XML + &quot;<PMT_TYP_CD>&quot; + @PaymentTypeCode + &quot;</PMT_TYP_CD>&quot; + &quot;<PMT_TYP_DESC>&quot; + @PaymentTypeDescription + &quot;</PMT_TYP_DESC>&quot; to: SET @Payment_Types_XML =...
  12. grahamm

    Why @@servername is null

    Does this server participate in a replicated environment? We had a similar problem in our replicated environment. If I remember correctly, the replication set up sp's manipulate the sysservers table, and this caused problems... Sorry I couldn't be more specific, but it was about 1 yr ago.
  13. grahamm

    Customer locality..?

    I don't know general sql stmt that will work if LocalityX is not known a priori. However if it is known e.g. the only localities are A,B,C then you can write sql such as: select distinct z.CustName, Locality1=a.Locality, Locality2=b.Locality, Locality3=c.Locality from geo z, geo a , geo b...
  14. grahamm

    SQL Server 2000

    You request is not clear. Could you elaborate. To project out the balance column, the SQL is for example: select Balance from Ledger However I expect this is not what you mean.
  15. grahamm

    Tables Error - Opening tables SQL 7.0

    It may be a bug. You don't say which tool you're using (Enterprise mgr?) however, take a look at these MS articles: http://support.microsoft.com/support/kb/articles/Q273/4/72.ASP http://support.microsoft.com/support/kb/articles/Q193/3/39.ASP

Part and Inventory Search

Back
Top