New answers tagged


Have you tried using dynamic sql? Something like this: declare @fieldLogID nvarchar(256) = ? declare @accountTypes int = ? declare @sql nvarchar(1000) = '' SET @sql = 'select fl.[Version] ,fl.ObjectID ,[FieldLogID] ,Cast(fl.WorkStartDateTime as date) as WorkStartDate ,Cast(fl.WorkStartDateTime as time) as ...


Your "IN" statement will not work unless the @fieldLogID variable is of "TABLE" type and not single value type. You can either: Switch the "IN" to a LIKE" and reverse the two, as such (this is a bit lazy and taxing on resources, at LIKE is sort of expensive): WHERE @fieldLogID LIKE '%' + fleja.FieldLog_FieldLogID + '%' Or (and my preferred method) you ...


I believe this was introduced in SQL 7. If memory serves me right, I was able to access a SQL 6.5 server from a SQL 7 server, but I could not access SQL 6.5 from/to another SQL 6.5 (I don't think the sp_addlinkedserver stored procedure existed prior to SQL 7).

Top 50 recent answers are included