SQL 2012 :: SSMS Auto-recovery / Auto-save New (unsaved) Queries

Feb 16, 2014

Since upgrading from SQL Server Management Studio 2008 R2, I've noticed that it no longer autosaves queries that have not been manually saved first. If a file has been manually saved the autorecover files end up in the following directory:

%appdata%MicrosoftSQL Server Management Studio11.0AutoRecoverDatSolution1

However, I have ended up in the situation where I have unsaved queries when my computer has crashed and have not been able to recover them.

I have also found references to .sql files stored in temp files in the following directory, but the files here seem to be very haphazardly caught:

%userprofile%AppDataLocalTemp

View 2 Replies


ADVERTISEMENT

Auto Increment Auto Non-identity Field

Jan 23, 2004

I have an MS SQL Server table with a Job Number field I need this field to start at a certain number then auto increment from there. Is there a way to do this programatically or within MSDE?

Thanks, Justin.

View 3 Replies View Related

Auto-Export Results Of 3 Queries To Excel

Oct 12, 2012

I am running a SQL stored procedure which runs 3 queries on 3 different SQL tables. What is my best option to export the results of these 3 queries to excel?

If it matters they are all SELECT queries, and at most will return < 500 rows.

View 6 Replies View Related

Reporting Services :: SSRS - Auto Generate Multiple PDF Files And Save Into Window Folder?

Jul 15, 2015

We have the following requirement :

1. In daily basis auto loop through each item in the invoice table.

2. passing invoice number into a Summary SSRS report as parameter.

3. Auto download ALL generated PDF reports into a window folder with a special file name format i.e. <INVOICE_NO>_<DATE>.pdf

how to achieve this via SSRS, Store Procedure or Power Shell?

View 4 Replies View Related

Recovery :: Where To Place Witness Server For Mirroring Using High-safety And Auto-failover

Apr 9, 2015

We have 2 data centers, site 1 and site 2.  Site 1 is generally our primary, and site 2 is our Disaster Recovery (DR) site.  I want to setup a SQL instance to have extremely high availability.  Therefore I was looking at using DB mirroring, with synchronous data writing, high-safety and auto-failover.  This requires the usage of a witness server.My problem with this setup, is that if the witness and principal are both at site 1, if site 1 goes away (power failure, asteroid impact, lol, anything else that would be a *true* DR scenario), then there is no failover to the mirror server at site 2.   However, if you put the witness at site 2, anytime the WAN link between site 1 and site 2 has an issue, the DB will auto-failover to site 2.  Is the reason for the recommendation of the witness being at the primary site because the thinking is that WAN link failure is likely more common than a *true* DR scenario that takes out all of site 1?

View 3 Replies View Related

SQL Tools :: Change SSMS 2012 Default Query Save Location?

Dec 2, 2013

is there a way to change SSMS 2012 default query save location?

Scenario:

1. Open SSMS
2. Create new query
3. Click Save

I see "DocumentsSQL Server Management Studio" folder, but I want to change it to be "d:". How do I do this?
I tried:

1. [URL]- in folder "DocumentsSQL Server Management StudioSettingsSQL Server Management Studio" there is a file NewSettings.vssettings, setting it to "d:" or "d:" didn't work.

2. Changing HKEY_CURRENT_USERSoftwareMicrosoftMicrosoft SQL Server100ToolsShell VisualStudioProjectsLocation didn't work too. There is no "Shell" under "110Tools"

Did I do something wrong, or is there another way?

View 6 Replies View Related

SQL 2012 :: Cluster Errors - No Auto Fail Over?

Jun 25, 2014

My environment is a 64 bit Windows Server 2012 Standard edition that is running SQL Server 2012 SP1 Standard Edition (64 bit) which has an Active Passive Cluster set up and I unfortunately had no involvement in this cluster build. The person who did is no longer with the company and is not responsive to questions.

This morning this following errors popped up:

Event ID: 1230 - Cluster resource 'Databases' (resource type 'Physical Disk', DLL 'clusres.dll') did not respond to a request in a timely fashion. Cluster health detection will attempt to automatically recover by terminating the Resource Hosting Subsystem (RHS) process running this resource. This may affect other resources hosted in the same RHS process. The resources will then be restarted.

The suspect resource 'Databases' will be marked to run in an isolated RHS process to avoid impacting multiple resources in the event that this resource failure occurs again. Please ensure services, applications, or underlying infrastructure (such as storage or networking) associated with the suspect resource is functioning properly.

Event ID: 1146 - The cluster Resource Hosting Subsystem (RHS) stopped unexpectedly. An attempt will be made to restart it. This is usually associated with recovery of a crashed or deadlocked resource. Please determine which resource and resource DLL is causing the issue and verify it is functioning properly.

When I saw these errors, I brought the "Databases", "Logs", and "Quorom" disks back online and all was well. I then proceeded to check Application and System Logs noticing there where some VMWare/SAN errors that caused the CPU spike resulting in the Cluster errors.

Regarding the questions, why didn't a failover occur and What can I do to mitigate this process are now what I am focusing on. Researching the above errors, I discovered that you could a policy based what happens in a situation like occurred this morning. You can set policies at the Role level, "Server" level, and at the disk level.

The Role Policy seems to be a little less involved, screenshot RoleProperties.png show these. I assume these are defaults. The server name properties are set to the following screenshot, Servername_Properties_Policy.png. This seems to be correct to me, but there is where I am lacking. I think this means that if it fails at this level all associated resources, disks, etc will failover to node 2.Now where I think the issue is, the third screenshot, Database_Properties_Policy.png. There is no policy set to for situation where a disk resource fails. Which I believe is what happened this morning. Some questions:

1. Do I need to set this similar to what is in the ServerName screenshot?
2. What happens if I check the box for "If restart is unsuccessful, fail over all resources in the role"? Will this only fail over this one disk? If so, it doesn't seem like that would be ideal. Would it fail over at the Role level and move over all associated resources?

I am also not sure what time limits I should set for Period restarts, maximum restarts, delay between restarts, etc...

View 3 Replies View Related

SQL 2012 :: Hash Deleted And Auto-increment ID By 2 Not 1?

Sep 15, 2014

When I have a record that I copy and paste (Access 2010 datasheet view) into a new record with one column having a unique constraint , I display message "Cannot insert duplicate code" then if not all values in the record are inserted , I get a #deleted in all columns Refreshing , I find that the id is incremented by 2 instead of one.

That is if the previous record has ID 20 , the #deleted record has ID 22 .

avoid the #deleted which happens if not all columns are filled.

View 9 Replies View Related

SQL 2012 :: Drop All The Auto Generated Column Statistics?

Dec 29, 2014

My question: Is it okay to drop all the auto generated column statistics? (for the following scenario)

- I am cleaning up unnecessary objects (tables, unused indexes, overlapping statistics etc) from databases and found out there are more than 1400 auto generated column statistics on one database (lets call it A).
- Database A was used to be our reporting database but from last several years we are using database B for reporting. DB A has all the historical data while DB B only has valid records.
- We are updating all the column statistics with full scan nightly on database A and it is talking almost 2.5 hours to do that. Now I want to drop all the "unnecessary" statistics those were created when DB A was reporting database and they are no longer in use. There is no way to know the creation date of the column statistics that I know of. Statistics "last update date" is of no use because of our nightly job. So I was thinking of dropping all the auto generated column statistics and let the sql server create as it needs from now.

View 0 Replies View Related

SQL Server 2012 :: Auto Incrementing Alphanumeric Field In Table

Oct 1, 2014

I need to auto increment an alphanumeric field in a table.

The process is as follows:

1. First position is static letter C for contact or static letter A for account - field contact_id
2. The following 6 positions are numeric - example of the string would be C004658
3. When new contact is entered, it should look up the highest numeric value (in this case 004658) and increment it by one - resulting in C004659

View 9 Replies View Related

SQL 2012 :: Remove Auto Generated Statistics After Adding Index

Nov 21, 2014

We have implemented a very small reporting database which has a main table that started off small and has now grown to around half a million rows. Initially, there were no indexes on the table apart from a clustered index, but as the data has grown, performance has dropped and so we have added a number of indexes. This has resolved the performance issues.

Before creating the indexes SQL Server had auto created a number of statistic objects (_WA_Sys_000... etc). After creating the indexes, new statistic objects where created for the new indexes. In some cases, there are duplicate statistics (auto and index) for the same columns.Should I go through and drop the duplicate auto statistics? Will having duplicates cause issues at all?

View 2 Replies View Related

SQL 2012 :: Auto ID Primary Key Specified As Int And Table Data Is Deleted Periodically?

Jun 25, 2015

I have a table that has a primary key that is auto incremented by 1. This table's data is cleared out periodically and as data gets added the auto id primary key continues to increase in numeric value. Once the data is cleared from the table the auto id names could be used again(the eventId is not stored) Currently the eventID is at 26,581,399. I know the maximum int value is 2,147,483,647.

How should I handle this? or rebuild the table every time the data is cleared(problematically)?

View 3 Replies View Related

DB Engine :: 2012 EE SP2 / How To Auto-kill Sessions That Overuse TempDB

Jul 15, 2015

We have SQL Server 2012 EE SP2 server that is getting hit by reports that time-to-time use up to 300GB of tempdb.

It's happening because our clients can use 'bad' parameters for some reports.

Is there a way to autokill sessions that overuse tempdb (for example, if a session uses more than 15Gb in tempdb)?

Killing can happen immediately or after regular check (5 min for example).

View 3 Replies View Related

SQL 2012 :: Enable Catalog Startup Auto Execution For SSISDB After Creation?

May 31, 2014

There is a checkbox when you create an SSIS catalog which says "Enable automatic execution of Integration Services stored procedure at SQL Server startup". It's a good practice to have this option on. BUT! How do you verify whether this option is ON or OFF after you have created a catalog and how do you enable it if it wasn't enabled at the time of creating the catalog?

View 1 Replies View Related

Using For Xml Auto

Jul 27, 2004

Does anyone know how to use for xml auto that will format an xml response to show the parent/child relationships? I currently have the parents and children in a temp table and can only get a formatting so that each one is returned at a parent. how can i select the results from the temp table so for xml auto will return the properly formatted xml file?

this is also for the TreeVeiw control.

View 1 Replies View Related

FOR XML AUTO SQL 2K Vs 2K5

Apr 17, 2007

The upgrade adviser for for 2k5 says something about derived tables being handled differently between 2k and 2K5 and it says to query the tables directly but this does not seem to make much sense because I thought FOR XML AUTO just created some generic XML for presentation purposes. These 2 stored procedures that it is complaining about do query the tables directly and they use the FOR XML AUTO to control the output.Does anyone know if I have to worry about this? I am tempted to let this slide and check out this part of the application after the migration happens tomorrow for QA to start testing.Yes I have been googling, checking my books and digging around in BOL. I am not seeing anything.DISREGARD: I found my derived table. It appears to change the output of the XML. Perfect.

View 2 Replies View Related

Auto Increament

Apr 3, 2007

how to auto increament fieldname id which is set as a primary key in sqlserver 2005 inasp.net2.0

View 1 Replies View Related

Format Of For Xml Auto

Apr 11, 2007

I am using sql server 2000 and want to know how to get xml out of the database that looks like this using for xml auto
<Clients> <Client ID="1">  <Employer="Company1" />  <Employer="Company2" />  <Contact type="phone">  <contact type="email" value="test@test.com">  <contact type="phone" value="555-5555"> </Client> <Client ID="2">  <Employer="Company3" />  <Employer="Company4" />  <Contact type="phone">  <contact type="email" value="test@test.com">  <contact type="phone" value="555-5555"> </Client></Clients>
 The problem I am having is that Contact is nested inside employer when I select Employer before Contact and the opposite happens when I select Contact first.  They both join to the Client table so I would assume they both should nest directly under Client.  How do I get different fields to nest directly under the same element like above?

View 2 Replies View Related

Auto SQL Mail

Jun 15, 2007

 Hi,
 
 I have to generate mails automatically based on databse (SQL SERVER) table,In that table  we have expirydate as one column and
                   based on expirydate I have to generate the mails automatically,Please guide me to solve this issue.
                where we have to run the stored procedure.
            Do we have to use jobscheduler?
     please guide me  how to use it
Thanks in avance
regards,
Raja.

View 1 Replies View Related

Auto Counting In SQL

Oct 5, 2007

Hi all,
I would like to have my SQL statement result to return an additional "column", automatically adding an "auto-increasing" number with it.
So if I for example select all Dates older than today's date, I would want something like this:




1
10/12/2006

2
10/18/2006

3
10/20/2006

4
10/22/2006

5
10/30/2006
Keep in mind that it's not my intention to fysically insert the "counting" column into the table, but rather do it "virtually".
Is this possible? And if yes, how ? :)
 
Thanks in advance
Nick

View 6 Replies View Related

Auto Delete?

Oct 9, 2007

is there a way to auto delete all the record that is more than 1 month old compare to the date field in that table.

View 1 Replies View Related

Auto Increment

Mar 24, 2008

 DIAGID is the
field in database which is integer. i want to increment this when page is
loaded.but it is not working..

plz
find mistake ... thanks in advance

 

SqlCommand sqlCmd = new SqlCommand("Select max(DIAGID)  from tblDxactual",
sqlCon);

       
SqlDataReader sqlDr;

       
sqlCon.Open();

       
sqlDr = sqlCmd.ExecuteReader();

       
if (sqlDr.Read())

       
{

           
txtbxDiagID.Text = sqlDr[0].ToString()+ "1"
;    

       
}

       
else

        
txtbxDiagID.Text="1";

       
sqlCon.Close();

View 3 Replies View Related

Auto Email

Sep 9, 2004

Hi All,
I want to write a console application to send email. There is a Date field in the SQL Server and I need to send email 2 weeks before that date.I have no idea how to write a console application and make it work.Does anybody have code for this? If so please post it.
Thanks a lot,
Kumar.

View 2 Replies View Related

MS-SQL: Where's Auto Increment?

Feb 4, 2005

It's been a long time since I've had to check an index for the highest value, then add 1, to create a new unique key. These past few years, it seems this is usually done for you. But now that I'm working with MS-SQL, I don't see it. Is it there? It's doesn't seem to be inherent in the definition.

View 5 Replies View Related

MS SQL 05 Auto Increment

Jan 26, 2006

Hello,
Firstly Hello to everyone I'm new the forum and fairly new to .net
I'm working on web datbase application using visual studios 05 and MS SQL05 I've used 2003 (briefly) before but 2005 is very new to me.
To my problem I download the GUI interface from microsoft so I can now setup a local database and do my own testing.
I have created the table and fields with in it however on a particular table i have made a primary Key and left it as an INT but I would like to set it as auto increment ! I dont know how to select that option as i was used to mysql way of doing things or does this have to be done as a stored procedure ?
Any assistance much appreciated.
 

View 1 Replies View Related

Auto Increament

Apr 1, 2006

hello to all,
In Sql Server 2005, how to create a column that is Auto Increamented ???

View 1 Replies View Related

Help! Log Is Auto Shrinking Itself

Mar 4, 2002

HiRunning SQL 7 sp3 on NT 4

I have a database that has the auto shrink option turned OFF. However, the log file seems to auto shrink after the user
runs bulk insert.

The log file is not setup to auto grow either.Any ideas.

Thanks,
Tariq

View 2 Replies View Related

Auto Increment.... Key&#39;s... Etc..

Apr 4, 2001

I am very new to using SQL server 7. I've always used mysql in the past. I cant figure out howto create a autoincrementing key for my tables... is it possible to do in SQL7?? If so.. how.. i thought you just set the datatype to auto increment etc...

sorry for any oversights...


dave

View 1 Replies View Related

Auto Shrink Db

Oct 24, 2001

what's this : "auto shrink " db option in properties ???

in which case may i use this option ?
please help

View 3 Replies View Related

Reset Auto-Id

Nov 1, 2000

Can I reset the Auto_ID column in a table to start from 1 again?

Thanks

View 1 Replies View Related

Auto Number

Oct 26, 2000

can anyone give suggestions how to generating a number starting with certain numbers, example 33###, because when i insert new record into datatabase
i want the number start 33111, or something and next record is 33112
thanks

View 1 Replies View Related

Getting The Auto Value From Trigger

Jan 29, 2001

Hi all,

My requirement is to get the autoincrement column once a new row is inserted, we need the autoincrement value to update other tables, at present I am using an insert trigger in which I am extracting the autoincrement column from the 'inserted' table, but how far this work perfectly when multiple users insert simultaneously. Can any of you suggest me the best way to extract the actual value inserted.

Now the scenario is :

sp which insert a row
Begin tran
insert ...
select @returnKey = (select retkey from #temptab)
drop #temptab
Commit Tran

Trigger on insert

insert idcolumn into #temptab select autokey from inserted


If user A & B inserts row exactly at same time, will this method return the exact auto value what A and B have inserted to them respectively.

Thanks in Anticipation

Raj

View 1 Replies View Related

Auto Increment

Sep 23, 2002

I would like to avoid using a cursor. I am updating several rows in a table with sequential numbers starting at a number I pass into the Stored Procedure. Is there a way to do this with one update statement?

Thanks,
Ken Nicholson
Sara Lee Corporation

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved