SQL Server Management Studio 17.7 AutoRecover NOT IN THIS VERSION - sql-server

I am tearing my hair out because I was working on some SQL scripts and I executed them to ALTER stored procedure, however when I came in this morning I have lost all my work, it was showing the previous day's script. Somehow it didn't save even though I watched it Execute Successfully Completed!.
Now I thought that using Microsoft SQL Server Management Studio v17.7 there will be an auto recovery temp folder with SQL files somewhere, and from looking online its states to go here; C:\Users[User]\Documents\SQL Server Management Studio\Backup Files\Solution1\ and you will see Autorecovery.sql files lots of them.
However this is completely empty, and I got no idea where clever Microsoft has moved this new location too or removed it all together. I went to settings in my SQL studio under Tools->Options->Environment->AutoRecover and both are ticked for "Save AutoRecover Info every 5 minutes" and "keep autorecover info for 7 days". Which tells me it is somewhere on my PC.
I then thought that I might have lost my work and though it would be a good idea to test this scenario on some new scripts and guess what the folder path still shows empty whilst using MSSMS so I got no idea how to utilise this auto recovery feature for the future.
Any ideas.

Try searching in visual studio directories if you have it installed :
C:\Users\<your_user>\Documents\Visual Studio <your_version_visual_studio>\Backup Files\Solution1

SSMS 2017 seems to just keep the recovery files in %TEMP%\ (with name ~vsXXXX.sql)

I have realised the only way to make sure you are safe is to have a folder specified with all your scripts stored there.
This way the autosave only works when you have saved the file prior not unsaved files, so it will be a case of Save + Execute.
I have lost my work for now, but this is why people learn from there mistakes.

Related

SSIS file exist check works in SSDT not running from SSISDB

this is one that has me stumped and Ive been doing this a long while.
Migrating to SQL server 2016, large number of ETL. Easy enough.
One of the ETL packages has a simple script task to take a table of files, run a file exists foreach loop.
it uses a project parameter to create the unc ( \servername\share) and then binds that to the file name in the script task.
use an environment config setup in SSISDB
execute in SSDT works fine, deploy to catalog and it cant see the file. i know youll say permissions, but ive permissioned everyone group to share and drive in case its that. SSISDB execution means it should be running under my security context and im domain admin, local admin and creator owner of the share.
even strangeR, i have created simple package to grab the contents of one of the files and import into a dump table in case permissions or pathway were duff ( even though they work in SSDT might be the enviroNment config in SSISDB). THIS WORKS FINE, therefore it cant be the envrionment setup of SSISDB being referenced.
please note this is not running from an agent job yet so wont be due to agent server account issue. need to get it running from ssisdb first then ill create an agent job
So -- script task cant see unc share, built from two variables, that works in ssdt and its running under same credentials...
Go
For what its work the script task code is
Dts.Variables("BolFileExists").Value = File.Exists(Dts.Variables("StrLoadFileLocation").Value.ToString & Dts.Variables("StrCurrentFile").Value.ToString)
This is a slightly different answer as it shows a different approach and removes the script task. I use a foreach to check if the file exists using GUI tools provided by SSIS:
Well I found the answer and I deserve to punch myself in the face.
Tried everything, it was a file variable and path variable being pulled together in the script task so tried concatenation that before the script task, pumped this into a table to ensure it was going to write table.
Literally everything was fine and still didn’t work.
The issue....
Building it as a 2017 package onto a 2016 Sql server.
I’ve not found what was missing dll wise but it must have been one of those that meant the script task couldn’t find the files but weird it didn’t break and just said the files weren’t there!
Thanks all for input, I’m going to go put my head in the door and slam it

SSIS deployed package fails to map drive tag to network shared folder

Modifying this post as a friend has helped me figure it out.
The culprit was that SQL was not able to map drive tag to network shared folder, so the deployed SSIS package was not able to write. The execution report showed all green and success, so I was confused as a beginner. See also the comments below.
Backup original post below:
SSIS package text file write works in visual studio not when deployed on sql server
I have narrowed down the issue to the text file writing action in script task (C#), the experiment simply writes the current time stamp into a text file.
It works in Visual Studio 2015, both with (F5) and without (Cntl+F5) Debugger. The project is in package deployment mode. When deployed to a database server of SQL Server 2016 and manually trigger execute with Administrator login, the writing action never happens although execution report shows all success, and Windows system log shows no clue to me either.
I am a beginner on SSIS and hints and tips will be highly appreciated.
Yes, SSIS doesn't like mapping shared folder to a letter drive. Thanks #Nick.McDermaid .
Never use mapped drives. Use UNC instead i.e. \server\share\folder –
Nick.McDermaid Nov 8 '18 at 23:40

CS2001 Missing AssemblyAttributes.cs when executing SSIS package deployed to the server

I created SSIS packages and used the Integration Services Deployment Wizard to deploy it out to the server. I'm manually going to the Integration Services Catalog access through SQL Server 2012 and right-clicking and executing my package.
However, the package keeps failing and I'm getting the following errors when I check the execution report's messages.
They appear to be failing on data tasks where I have script components.
Assign :Error: CS2001 - Source file 'C:\Windows\TEMP.NETFramework,Version=v4.0.AssemblyAttributes.cs' could not be found, CSC, 0, 0
Assign :Error: Failed to compiled scripts contained in the package. Open the package in SSIS Designer and resolve the compilation errors.
This answer is a more detailed version of UberDoodles answer.
In Windows Explorer.
Navigate to C:\Windows\Temp\
Right click the folder and select properties
Go to tab Security, choose Advanced
On the default tab Permissions, choose Change Permissions
For the relevant Permission entry, choose edit.
By default, I had 'allow' checked for Traverse folder / execute file, Create files / write data and Create folders / append data.
Also check 'allow' for List folder / read data and Take ownership.
Press OK, the window closes
Press Apply and confirm anything you need.
Additionally, the logged in user had already Full control, but when I changed this for the entry 'Users', it worked for me.
(based on microsoft file/folder permissions).
I had the same problem today, just on SQL 2016.
For me it helped to change the target server version in Visual Studio project properties from SQL Server 2012 to SQL Server 2016.
I was investigating the same issue, and I came across a solution here :
https://social.msdn.microsoft.com/Forums/vstudio/en-US/73e67f3a-c575-4c73-a71d-ed7a2aeabb50/csc-error-cs2001-source-file-cwindowstempnetframeworkversionv40assemblyattributescs?forum=msbuild
Basically, the account which the package runs under needs to have full permissions to the C:\Windows\Temp\ folder, so that it can create temporary classes.
It worked for me :)
I had the same problem. I first used Eric G. response and added the List and Read permission to the c:\windows\temp. After I got everything working I went back and removed that permission. I then redeployed my solution from Visual Studio, this time designating the deployment target as SQL Server 2014 (which was the environment I was using) using Martin's solution. I then reran the process, and it worked with the List and Read removed.
I kept it using Martin's solution, as I don't like to have special permissions granted if I don't need them.
Good Luck
[Visual Studio 2017 15.9.16]
I just restarted Visual Studio as Administrator and the issue disappeared, which confirms the permissions idea of the answers above but spared me all work.
It's not a quirk though, as per this question and its answer you need that kind of permission for several tasks, like profiling and debugging under certain conditions.
For the sake of completeness, this blog says you might incur in some security contraindication if run VS as administrator when opening third-party solutions.

T-SQL IntelliSense does not work on some solutions

I have a solution in Visual Studio 2013, where among the others I have also a Database project. This project contains some .sql written in T-SQL.
IntelliSence and Parse (SQL (on visual studio menu) > Parse) do not work. I have gone through this Troubleshooting guide and many question on SO, but nothing worked.
As I understand is something in project setting that I need to configure or some leftovers I need to clean.
Any suggestions ?
In brief
IntelliSence is enable
SQL CMD is Disabled
In SQL Server Explorer there is an entry (localdb)\ProjectsV12 containing my DB.
Other solutions opened on the same instance of visual studio work fine
ReSharper is installed but is not the issue (I also tried without it)
Note:
The solution (the one that has issues) was created in a previous version of Visual Studio.
Update 15/12/2015
After some digging I found out that the issue may has something to do with the .v12.suo file (which is located alongside with .sln file and is hidden). Copping this file from a similar solution (one that IntelliSence works) eliminates the problem.
Another workaround that it may help, is to go to the "Database Project" properties (right click on the project in Solution Explorer and then select Properties), on the Debug tab and press Restore Default in "Target Connection String". In my case this just changes the Initial Catalog= value to Database and like "magic" IntelliSence works again! (in some cases it may need to restart the Visual Studio)
After this even if I restore (using Edit) the "Target Connection String" to the previous values the IntelliSence continues to work.

Change the location of the Auto Recovery information in SQL Server Management Studio

Our local IT has our My Documents folder on a network path. This causes a problem from MSQL Server management studio as it saves it auto recovery information every 10 min it will lock up as its doing its save.
I found where VS2008 saved its setting but I can not find out how to change it out of My Documents for this. Does anyone know where that setting is located?
Unfortunately, at least for VS2005 and VS2008 (and I think for VS2010, but I haven't checked there), this cannot be changed from the system's "My Documents" folder. This is terribly annoying, I agree, as we have our My Docs folder set to a network share. When we're on VPN, the network connection is very slow, so the auto-recovery feature isn't instantaneous and blocks the UI.
I found this feedback on Microsoft Connect that indicates the inability to change the setting: Saving Auto Recover Information in Visual Studio 2008 SP1
There are few "alternatives." You could, of course, turn off Auto-Recovery, but that's not generally recommended. What I've ultimately decided to do is simply increase the time interval between auto-saves. This is found under Tools\Options\Environment\AutoRecover (in VS2008), which is the same place you would go to turn it on/off.
Of course, in SQL Server Management Studio, there is no Environment\AutoRecover section in the options. However, if we remember that SSMS uses the Visual Studio core (and we're comfortable with a bit of registry hacking), we can adjust the time interval for SSMS, as well.
VS uses a REG_DWORD value named "AutoRecover Save Interval" to store the number of minutes between auto-saves. Just add that value to the following key in the registry (this is for SSMS2008). I set mine to 60 because I don't usually do much super-critical work in SSMS, but you can set it to a value that suites you.
HKEY_CURRENT_USER\Software\Microsoft\Microsoft SQL Server\100\Tools\Shell\General\AutoRecover
I realize this isn't really a solution to the original issue, but I think it's at least a viable alternative.
As a follow up, with later versions of SSMS Microsoft did add Auto Recover settings in Tools > Options > Environment > AutoRecover.
I found recovered files on my machine at: C:\Users<MyUserName>\Documents\Visual Studio 2017\Backup Files\Solution1

Resources