The Heap™ – Consultancy ©®

General on- and off-site discussion for dba.stackexchange.com....
Mar 28, 2018 21:46
Thanks @ypercubeᵀᴹ. I'll check the article.
Mar 28, 2018 21:44
and because it had single quotes at execute(@sql) it was not forming the proper string.
Mar 28, 2018 21:44
my actual replication data had issues because of the details I gave above.
Mar 28, 2018 21:41
@Mailtext is a combination of my HTML header + actual replication data and HTML footer.
Mar 28, 2018 21:41
SET @sql = 'msdb.dbo.sp_send_dbmail @profile_name =
''DBA'', @recipients = ''' + @Recipients + ''',
@subject = ''' + @MailSubject + ''', @body = ''' + @Mailtext + ''',
@body_format = ''HTML'' '
EXEC (@sql)
Mar 28, 2018 21:41
I am doing this.
Mar 28, 2018 21:35
I was stupid, I couldn't figure out how to replace it. But thank you guys!
Mar 28, 2018 21:34
I replaced it and now it is working fine.
Mar 28, 2018 21:33
so I my query I wanted to replace single quotes with two single quotes so that it can execute it.
Mar 28, 2018 21:33
and since it contained single quotes my exec(@sql) encountered Msg 102, Level 15, State 1, Line 38
Incorrect syntax near '\'.
Mar 28, 2018 21:32
I am getting this status using replication system procs and sending it as an HTML report via exec(@sql)
Mar 28, 2018 21:31
The distribution agent failed to create temporary files in 'C:\Program Files\Microsoft SQL Server\100\COM' directory. System returned errorcode 5. (Source: MSSQL_REPL, Error number: MSSQL_REPL21100)
Mar 28, 2018 21:31
I have a script to monitor replication and today I encountered below error in my replication.
Mar 28, 2018 21:29
@dezso: Thank you! That fixed it for me.
Mar 28, 2018 21:21
for example replace 'C:\Test' with ''C:\Test''. Please note that I need to replace it with two single quotes and not double quotes. I know its weird. I wasn't able to make it work using replace and need your help.
Mar 28, 2018 21:17
Can someone please help me with how do I replace single quote with two single quotes in SQL Server?
Mar 28, 2018 21:16
Hello experts
 
Aug 29, 2017 10:25
If you have the copy of mdf file put it on correct location and try to bring DB online. Otherwise restoring the DB is the only option you have to bring the DB online.
Aug 29, 2017 10:25
Thats the issue. When you OFFLINE the DB it releases file locks from DB files. So there are chances that someone may have deleted it.
Aug 29, 2017 10:25
Does the database files(mdf and ldf) exist on your local disk? You can check the file locations from sysaltfiles for that DB.
 
May 17, 2017 14:37
It was nice I could catch you up on chat and get it clarified. Updating details in the form of question is sometimes not that useful.
May 17, 2017 14:36
Thanks once again! You rock!
May 17, 2017 14:35
will upvote and accept your answer in few mins.
May 17, 2017 14:35
I appreciate your assistance.
May 17, 2017 14:35
great! I think I am clear now.
May 17, 2017 14:34
ok and for example I have login test which is non sa, and if the job is owned by that test login it will be executed in context of test. Right?
May 17, 2017 14:32
sa
May 17, 2017 14:30
So for my update which is T-SQL it will use SQL agent account and again this internally uses 'NT SERVICE\SQLSERVERAGENT' account. Am I right?
May 17, 2017 14:27
Regarding my 2nd question, what user/login it uses in case of my update job with sa as job owner and non sa job owner?
May 17, 2017 14:27
Thank you!
May 17, 2017 14:26
ok. If that's the case then it answers my first question.
May 17, 2017 14:23
I saw your edit. Do you mean even if you configure SQL Server agent service to use domain account but it internally it still uses NT SERVICE\SQLSERVERAGENT to login to SQL Server and do all its activities?
May 17, 2017 14:21
I want to discuss with you on my question SQL Server agent job question
May 17, 2017 14:17
Hello SqlWorldWide
 
Sep 15, 2016 15:37
Have a good day! Bye!
Sep 15, 2016 15:34
add any comments if you want.
Sep 15, 2016 15:34
Upvote/accept if you think it was helpful.
Sep 15, 2016 15:34
I posted an answer.
Sep 15, 2016 15:33
Since it was default* service account ..
Sep 15, 2016 15:32
Since it was service account I asked you to give FULL permissions to everyone. However in real PROD cases it is generally configured using Domain account. So in that case you only need to grant rights to that domain account.
Sep 15, 2016 15:31
that is because you used default system accounts to install SQL Server.
Sep 15, 2016 15:25
then search SQL Server services there. There you need to check LogOn As account. That is what you need.
Sep 15, 2016 15:24
go to run and type services.msc
Sep 15, 2016 15:24
There are two ways one using config manger and other using services.msc.
Sep 15, 2016 15:21
I didn't know that opening and closing master key was required. Lot of articles on web suggests without doing that.
Sep 15, 2016 15:20
great!
Sep 15, 2016 15:13
Restore?
Sep 15, 2016 15:13
cool!
Sep 15, 2016 15:13
Certificate created?
Sep 15, 2016 15:12
ok. So did it finally work?