Error on using user!userid

  • HI,

    I want to get records based userid. I wrote query some thing like this. But i get this error when i try to run the report.

     The  expression for the query ‘Employee’ contains an error: [BC30648] String constants must end with a double quote.

    My Query is

    ="SELECT     Employee_ID, domain_login

    FROM         Employee where domain_login=user!userid"

    Can any one help me with this??

    Thanks,

  • Hi

    Sorry for the stoopid question but what are you writing this in?

    I've never seen the "user!userid" construct within  T-SQL. Perhaps it's just something I've missed.

    Sam

  • Sam,

     I'm creating report using Reporting Services.

  • Anyway, i got it.

  • I am having the same problem - what was the answer?

    I suspect a problematic embedded carriage return...

  • Could be a type but the User!UserId need to be outside of the quoted dynamic sql string, probably should be quoted with single quotes if being passed to MSSQL (it's a character string) and also case sensitive i thought?

    e.g. ="SELECT Employee_ID, domain_login FROM Employee where domain_login = '" & User!UserId & "'"

    Your CR issue may be solved by either i) doing the statement as one long string (ugly at times) or using the .Replace(Chr(10), " ").Replace(Chr(13), " ") to replace the CR and LF's out with spaces.

    Steve.

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply