September 26, 2014 at 1:03 pm
Hi,
I need to update the account_status and show the audit in the ssrs report.
I wrote the following query in the ssrs report but when I click on refresh fields it is throwing error incorrect syntax near output
Declare @username nvarchar(50)
Declare @UserStatus Table
(id bigint,
Username nvarchar(50),
Oldaccount_status varchar(255),
Newaccount_status varchar(255))
update Tableuser
set account_status = 'Enrolled'
where username=@username
output inserted.id, inserted.username,deleted.account_status,inserted.account_status
into @UserStatus ;
select temp.id, temp.username,temp.Oldaccount_status,temp.Newaccount_status,eu.id, eu.first_name, eu.last_name, eu.title, eu.account_status, eu.email, eu.username, o.account_number, o.name
from @UserStatus temp
join Tableuser eu
on eu.id=temp.id
join organisation o
on o.id=eu.id
where username=@username
I couldn't able to figure out the problem
September 26, 2014 at 1:24 pm
Now I changed
update Tableuser
set account_status = 'Enrolled'
output inserted.id, inserted.username,deleted.account_status,inserted.account_status
into @UserStatus
where username=@username ;
instead of
update Tableuser
set account_status = 'Enrolled'
where username=@username
output inserted.id, inserted.username,deleted.account_status,inserted.account_status
into @UserStatus
Now it is showing that ambigious column name username but the username exists
September 26, 2014 at 1:41 pm
Hi,
Figureout the cause of error
select temp.id, temp.username,temp.Oldaccount_status,temp.Newaccount_status,eu.id, eu.first_name, eu.last_name, eu.title, eu.account_status, eu.email, eu.username, o.account_number, o.name
from @UserStatus temp
join Tableuser eu
on eu.id=temp.id
join organisation o
on o.id=eu.id
where username=@username
Here I need to remove the where username=@username and temp.id,temp.username columns
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply