Quantcast
Channel: SQL Server Database Engine forum
Viewing all 15930 articles
Browse latest View live

Errors and Logging

$
0
0

All,

In one of our application, some  errors that are generated are not captured on the database side. For example, errors such as “Cannot insert the value NULL into column '%.*ls', table '%.*ls'; column does not allow nulls. %ls fails.”.  

select*from sys.messageswheremessage_id IN(515,8153)andlanguage_id = 1033

In this example, I was able to force an entry into the SQLServer Error Log by updating the is_event_logged column to 1 (sp_altermessage 515, 'WITH_LOG', 'true';). Like this error, the application might be generating other errors too. I’m aware that one can write an Event Notification process  or Server-Side Trace to capture the error message (and code) via the USER_ERROR_MESSAGE event. But how would I capture the actual code that resulted in the error and email the same?

For example,

CREATETABLE[dbo].[Tab1](

      [Col1][int]NOTNULL,

      [Col2][nvarchar](50)NULL

)

GO

INSERTdbo.Tab1(Col2)values ('test comment')

The insert results in the error

Msg 515, Level 16, State 2, Line 1

Cannot insert the value NULL into column 'Col1', table 'DBAArchive.dbo.Tab1'; column does not allow nulls. INSERT fails.

The statement has been terminated.

I was hoping to use something like EVENT NOTIFICATION services that would capture the error message and the code behind the error message and email these two to the stakeholders. Keen to hear the best practices.

Thanks,

rgn


Is there a way to verify the integrity of the log file?

$
0
0

SQL Server 2012 SP 2 on Windows 2012. Yesterday a transaction log backup against the largest database (50 GB database, 5 GB log) failed with the error below. SAN admin tells me everything is fine.

Backup detected log corruption in database SQLMonitor. Context is Bad End Sector. LogFile: 2 'E:\SQLDatabases\SQLMonitor_log.LDF' VLF SeqNo: x236a98 VLFBase: x44630000 LogBlockOffset: x4c47c400 SectorStatus: 4 LogBlock.StartLsn.SeqNo: x236a98 LogBlock.StartLsn.Blk: x3f1eb Size: xf000 PrevSize: xd200

I ran a full backup, changed the recovery model to simple, ran a checkpoint, changed the recovery model back to full, and ran another full backup. Subsequent full and transaction log backups ran fine.

Is there something similar to DBCC CheckDB that I can run to verify the integrity of the transaction log?

Partion Function with Where Clause

$
0
0

Hi Team,

I am facing issue in generating total sum and daily sum from table ThresholdData.

DailyTransactionAmount should be sum of todays amount in the table

TransactionAmount should be sum of all amount in the table.

Basically,

1. I don't want to scan ThresholdData table twice.

2. I don't want to create temporary table/table variable/CTE for this.

3. Is there is any way to make it done in single query.

  I hope, where criteria is not possible in partition function.

I am trying query something as given below,

SELECT  TransactionDate,
  TransactionAmount,
  ROW_NUMBER() over (order by TransactionDate) AS TransactionCount,
  SUM(TransactionAmount) over (partition by id ) AS TransactionAmount, 
  SUM(TransactionAmount) over (partition by id ,CONVERT (DATE, @TodaysTransactionDate)) AS DailyTransactionAmount
 FROM ThresholdData
 WHERE id = @id
 AND transactiondate >= dateadd(d,-@TransactionDaysLimit,@TodaysTransactionDate)

 

s

Memory table not cleared if created inside a while loop

$
0
0

If I create a memory table inside a while loop, I expect that every loop the memory table is (newly) created and thus empty.

But when I test this, I see that on the second, third, ... run the inserted data in the memory table is still present and not cleared.


This can be reproduces with the following code:

DECLARE @tbl TABLE
( [id] BIGINT )

DECLARE @tbl2 TABLE
( [value] BIGINT )

INSERT INTO @tbl
VALUES (1), (2)

DECLARE cur CURSOR FOR
  SELECT *
  FROM   @tbl

DECLARE @curid BIGINT

OPEN cur
FETCH next FROM cur INTO @curid

WHILE @@FETCH_STATUS = 0
  BEGIN
      DECLARE @tempcurtable TABLE
      ( [value] BIGINT )

      SELECT 'NOT EMPTY ON MULTIPLE RUNS', *
      FROM   @tempcurtable

      INSERT INTO @tempcurtable
      VALUES (11), (12)

      INSERT INTO @tbl2 (value)
      SELECT value
      FROM   @tempcurtable

      FETCH next FROM cur INTO @curid
  END

/*
	Expectation: twice 11 and 12 in @tbl2
	Actual result: three times 11 and 12
*/
SELECT *
FROM   @tbl2 

Is this a wrong assumption or is this a bug in SQL Server? (Tested on: SQL Server 2014 and 2008).

Reduce VLFs

$
0
0

Hello,

I looked at the number of VLFs in ony databases and figured out it was 300. I looked at the log file and its 40GB with 99% free space. I reduced the log file to 1GB. Now I looked at the VLFs and the count is 250. so 250 vlfs in a 1GB of log file. Is there a way to get the VLFs to a decent number?

Also my transaction log backups run once every 5 mins and auto growth on data and log files is 10MB.

Thanks

Migrate SQL 2008 R2 to a new SQL 2012 Server

$
0
0

Can anyone tell me if the following plan works:

  1. Setup the new server. Install SQL 2012, move all server objects (logins, databases, jobs, alerts, operators, etc.) to the new server. Keep the user database physical file directory/security same as the old server.
  2. Test the new server. While testing the new server, the old server remains as the production server.
  3. On the target deploy day, clone the old server user database disk volume, and attach the disk to the new server.
  4. The new server (SQL 2012) will detect the database files are in old SQL 2008 R2 format and automatically do the conversion.

My question is should I detach all the testing databases before attach the cloned disk to the new server, and manually attach the user databases after the disk is attached. Or SQL Server can automatically do the conversion as step 4 described.

Thanks,

Lijun Zhang

database default location is not showing system drive

$
0
0
In SQL Server 2012 Instance properties ,database default location is not showing system drive E:\ which was my backup drive .How can I add it again?

Thanks



September SS DBE Gurus Announced! Behold, the cream of the community! Join us!

$
0
0

The results for September's TechNet Guru competition have been posted!

http://blogs.technet.com/b/wikininjas/archive/2015/10/19/the-microsoft-technet-guru-awards-september-2015.aspx

Below is a summary of the medal winners for September. The last column being a few of the comments from the judges.

Unfortunately, runners up and their judge feedback comments had to be trimmed from THIS post, to fit into the forum's 60,000 character limit, however the full version is available on TechNet Wiki.

Some articles only just missed out, so we may be returning to discuss those too, in future blogs.
 

Guru Award BizTalk Technical Guru - September 2015  

Gold Award Winner

Janardhan BikkaBizTalk Server 2013 R2 integration with MS Dynamics CRM 2015Sandro Pereira: "Great topic, great article, well explained, lot of pictures, WOW keep coming! The layout/presentation of the article need to be treated and improved, but that I minor point regarding the quality of the article"
Abhishek Kumar: "Very good Article on CRM integration and well explained . Thanks for your Contribution ."
LG: "Material is interesting, but article content is too long."

Silver Award Winner

Rahul_MadaanPassing a message to BRE using Call Rules ShapeSandro Pereira: "The layout/presentation of the article need to be remade (different types of lettering, pictures could be better, pour layout of headers,…). This is a beginner article and steps explanations should be better detailed. This way the article is difficult to read and understand by their audience."

Guru Award Forefront Identity Manager Technical Guru - September 2015  

Gold Award Winner

Ryan NewingtonTake the guess work out of XPath with the Lithnet FIM Service PowerShell Module

Søren Granfeldt: "Excellent stuff"

Ed Price: "Great use of links for cross referencing!"

Silver Award Winner

Peter Geelen - MSFTFIM 2010: Verifying the Sync Engine Security Groups

Søren Granfeldt  "Nice work Peter"

Ed Price: "Good use of images and great to include the script sample!"

Bronze Award Winner

Wim BeckFIM2010: Localize Self Service Password Reset

Søren Granfeldt: "Thank you for this Wim!"

Ed Price: "Fantastic depth and great to read. Great article!"


Also worth a mention were the other entries this month:

Guru Award Microsoft Azure Technical Guru - September 2015  

Gold Award Winner

Michel JatobaStop and Start VMs with Automation on Microsoft Azure

JH: "Very good article with a detailed step-by-step guide. Love the amount of pictures."

Ed Price: "Great topic and great use of images! What a valuable article!"

Silver Award Winner

Samir FarhatCreate an URL Rewrite service via Azure Web App

JH: "Not an advanced topic, but most people struggle on it. Really good explanation."

Ed Price: "Perfect! I love this direct and thorough how to! Fantastic job on this!"

Bronze Award Winner

Ruud BorstMulti-tenant Azure AD federation with PowerShell

JH: "Interesting article. Would be better to have less text and a more detailed explanation of the script."

Ed Price: "Great scenario with a ton of explanation! More of a breakdown on the script would be good, but I still love the large amount of details here! Great job!"


Also worth a mention were the other entries this month:

Guru Award Miscellaneous Technical Guru - September 2015  

Gold Award Winner

Rishabh BangaFull Home Automation with Azure & Voice Assistance using Intel Galileo Gen 1 & Windows 10Durval Ramos: "This is an inspiring and practical article, which combines multiple platforms and allows you to create a very useful solution."
Richard Mueller: "A very interesting and potentially useful idea. Good detailed steps, with lots of code. Good images and great use of Wiki guidelines."

Silver Award Winner

Pooja BaraskarSmart Baby Monitor with Intel Edison and UbidotsDurval Ramos: "This article is interesting and presents the "simple content". It's very easy to understand what must be done, but need to add "References" section to indicate where his work was inspired."
Richard Mueller: "What a great idea. Very good images and detailed explanation."

Bronze Award Winner

Carmelo La MonicaPart one: tools for debugging in Visual Studio 2015Durval Ramos: "This article presents a resource that can be the difference between a successful solution and a project that should be reformed. Very good"
Richard Mueller: "Good introduction to VS 2015. Good images and explanation. Grammar needs works."


Also worth a mention were the other entries this month:

Guru Award SharePoint 2010 / 2013 Technical Guru - September 2015  

Gold Award Winner

Dan ChristianCloser look at SharePoint Server 2016 PreviewAshutosh Singh: "Thanks Dan"
TN: "A good wrap-up in SharePoint 2016"

Silver Award Winner

Inderjeet Singh JaggiSharePoint 2016 Farm configuration issue on Windows Azure Virtual MachineAshutosh Singh: "This is very good"
TN: "An interesting post"

Bronze Award Winner

Dan ChristianInstalling the Office Online Server PreviewTN: "Great article on how to set up Office Online Server including some common issues"
Ashutosh Singh: "Thanks for this Dan"


Also worth a mention were the other entries this month:

Guru Award Small Basic Technical Guru - September 2015  

Gold Award Winner

Emiliano MussoPrime Number Factorization with Small BasicMichiel Van Hoorn: "Put your math to practice. Great write up. "

Silver Award Winner

Ed Price - MSFTSmall Basic: Automatic Type ConversionMichiel Van Hoorn: "Useful if you are starting juggling with numbers in Small basic"

Guru Award SQL BI and Power BI Technical Guru - September 2015  

Gold Award Winner

Maruthachalam KCreating reports using OData Feed in Power BIRB: "Nice explicative walkthrough."
JS: "Great article, I would want one word concerning security of ODATA feeds in the article as well."
Durval Ramos: "This article is very well illustrated, but need to add the "References" and "See Also" sections to valuable this article. Additional information is needed to validate your content"
PT: "This post demonstrates the ease and utility of Power BI with an OData data source. Thank you for this valuable contribution."


Also worth a mention were the other entries this month:

  • SSRS: Join data from different SSRS data sources into data set by sergey vdovin
    PT: "At first I had mixed feelings about promoting these techniques as a best practice, given the level of complexity. However your approach to this challenging problem well executed and clearly explained. Thank you for posting this useful information."
    RB: "Not much information here, apart from link to github projects"
    OT:"I personally don´t see any greater benefit in writing a separate article and referring an already existing one without pointing out really new stuff. The old one is pretty good and although the author does not get much love updating this, he should in order to have the thing in one place."
    AN: "The content is not complete and the "Solution" section was written in another article. This article's very confused."

Guru Award SQL Server General and Database Engine Technical Guru - September 2015  

Gold Award Winner

Martin SmithClustered and Nonclustered indexesJS: "Instead of "to explicitly include all non key columns" => "to explicitly include one or more non-key columns". Liked the spatial representation!"
AM: "Simple and concise explanation. Great illustration as a plus."
Durval Ramos: "A good presentation about how each index works."

Silver Award Winner

Yashwant VishwakarmaSQL Server Databases: Back To BasicsJS: "Although nothing really leading edge, a good start for new beginners in one place. I would want more references to MSDN articles in order to enable the reader digging in a bit deeper."
Durval Ramos: "This article's a good summary about "some" SQL Server features and has good images, but I believe that can be improved if add more details in each database type"

Guru Award System Center Technical Guru - September 2015  

Gold Award Winner

Adin ECluster Patching Showdown: Comparing SCVMM and SCCM Patching

Peter Laker: "An excellent and in depth article"

Ed Price: "Wow! Fantastic details!"

Silver Award Winner

Foothill1SCSM Data Warehouse Search Tool

Peter Laker: "Thanks for the contribution Foothill1"

Ed Price: "Good topic. The example is helpful."

Guru Award Transact-SQL Technical Guru - September 2015  

Gold Award Winner

Martin SmithUnpivot vs ApplyManoj Pandey: "Very informative post about usage of UNPIVOT and/vs CROSS APPLY. But you could have given more details on the top of what are you covering in your post."
Durval Ramos: "This is a good article, but need add "References" and "See Also" sections to additional content based on their original idea (post or article)."
Richard Mueller: "Good use of Wiki guidelines. I liked the images. A See Also and Other Resources could be useful."

Guru Award Universal Windows Apps Technical Guru - September 2015  

Gold Award Winner

Rishabh BangaFull Home Automation with Azure & Voice Assistance using Intel Galileo Gen 1 & Windows 10

JH: "What an article! Needs just a little formatting. Love the whole IoT stuff."

Ed Price: "This is truly beautiful! The hardware images are helpful, the UI images are great, and the code is formatted very well! Plus the topic is ambitious and fun!"

Silver Award Winner

Afzaal Ahmad ZeeshanBuilding camera app with library in Windows 10

JH: "Very detailed explanations and a lot of code snippets. A good one."

Ed Price: "I love how this is a specific app type. Very useful for developers!"

Bronze Award Winner

SYED SHANUWindows 10 Universal App Development for Name Puzzle Game

JH: "Fun article. Will try this one myself."

Ed Price: "What a fun game! Fantastic execution on this article! Great job!"

Guru Award Visual Basic Technical Guru - September 2015  

Gold Award Winner

Emiliano MussoBasis of Neural Networks in Visual Basic .NETCarmelo La Monica: "Fantastic!!! Perfect article, great code snippet and theory of Neutral Networks. Congrats!"
Richard Mueller: "Very interesting topic and well researched. Would be great to play with this. Grammar could be improved."
MR: "Great article!"

Silver Award Winner

.paul.CheckBoxColumn Select All DemoMR: "Simple but very effective!"
Carmelo La Monica: "Great topic and useful for to extend function on Datagridview."
Richard Mueller: "A well written article. I would like to see more links to other references."

Guru Award Visual C# Technical Guru - September 2015  

Gold Award Winner

SYED SHANUDataGridView Gantt style chart using C# WinformCarmelo La Monica: "Very interesting topics and very and useful for to extend function on Datagridview. Congrats!"
Jaliya Udagedara: "Explains a solution to a specific problem. Love the fact that sample code is available to download. A bit of formatting is needed in the article."

Silver Award Winner

Ken CenerelliUnderstanding the Visual Studio AssemblyInfo ClassJaliya Udagedara: "Well explained the topic for well formatted. It’s just perfect."
Carmelo La Monica: "Congratulations, article very detailed in all parts, useful for to understand AsssemblyInfo Class, good code snippet and images."

Bronze Award Winner

Gaurav Kumar AroraC#: How to check whether API server is up or downJaliya Udagedara: "Little bit of code formatting and a link to download the sample code will help readers a bit more."
Carmelo La Monica: "Great topics and very useful for to understand if api server in up o down. Congrats!"


Also worth a mention were the other entries this month:

  • MVC Web API And AngularJS: Are You Genius Game bySYED SHANU
    Carmelo La Monica: "Interesting, i don't have experience on Asp.Net, but article very interesting, good image and code snippet."
    Jaliya Udagedara: "Explains a specific application. Love the fact that a lot of images is used and sample code is available to download which helps the readers. A bit of article formatting is needed."
  • Little More Information On Casting and Type Checking in C# byIsham Mohamed
    Jaliya Udagedara: "Explains the topic of the article in detail. If we can have little bit of formatting in the article, then it will be perfect."
    Carmelo La Monica: "Sometime is a problem for casting Object, but with this article we can to understand how to convert correctly an object or variable. Congrats!"
  • ASP.NET MVC HangFire - Execute Jobs in Background using SQLServer by João Sousa
    Jaliya Udagedara: "I would rather change the title of the article to “Configure Hangfire in an ASP.NET MVC Application”, because that is what explained in the article. Good job!"
    Carmelo La Monica: "Great content, and useful image and code snippet. Congratulations!"
  • MVC Web API and Angular JS For Word Puzzle Game bySYED SHANU
    Carmelo La Monica: "Same comment for MVC Web API And AngularJS: Are You Genius Game. Congratulations!"
    Jaliya Udagedara: "Explains a specific application. Love the fact that a lot of images is used and sample code is available to download which helps the readers. A bit of article formatting is needed."

Guru Award Wiki and Portals Technical Guru - September 2015  

Gold Award Winner

Ken CenerelliVisual Studio 2015 PortalDurval Ramos: "A great portal. Very useful !!!"
Richard Mueller: "Outstanding example of usage of Wiki Guidelines. And a great collection of links."

Guru Award Windows PowerShell Technical Guru - September 2015  

Gold Award Winner

Curtis SmithPowerShell: Directing DNS with PowerShellJan Egil Ring: "My favorite this month"
Richard Mueller: "A great article with excellent explanations and good use of Wiki guidelines. Good step by step detail. Some of the topics could go in another article, or you could reference existing references. For example, documentation of string methods and explanation of $_."

Silver Award Winner

Peter Geelen - MSFTPowerShell: Event viewer statisticsRichard Mueller: "Lots of code, but also lots of comments. Good use of Wiki guidelines. Great to give credit. Maybe could use some more discussion."
Jan Egil Ring: "Excellent work!"

Bronze Award Winner

Sravan EatoorPowerShell: Dynamic Form - All In One ToolJan Egil Ring: "Thanks Sravan"
Richard Mueller: "An interesting idea that might prove useful where organizations have collected many scripts."

Guru Award Windows Presentation Foundation (WPF) Technical Guru - September 2015  

Gold Award Winner

Andy ONeillMVVM Step by Step 2LL: "Good article!"
Peter Laker: "Nice work as always Andy!"

Silver Award Winner

Tom MohanHierarchical Binding Using HierarchialDataTemplateLL: "Nice 101"
Peter Laker: "Thank you Tom!"

Guru Award Windows Server Technical Guru - September 2015  

Gold Award Winner

Richard MuellerActive Directory: Allow Linked Multi-Valued Attributes to use LVRMark Parris: "Information to show that just by raising the FFL, there is still more work that may need to happen."
JM: "This is an excellent article, thanks for your continued contributions."

Silver Award Winner

Darshana JayathilakeFile Server Migration ToolkitMark Parris: "Useful information now that Windows 2003 is no longer a supported platform."
JM: "This is a great articled that will help admins migrate WS03 file servers, nice work."

Bronze Award Winner

FZBWSUS: the underlying Connection was closed during Server cleanupMark Parris: "Good tidbit of information around WSUS and the command line."
JM: "This is a very good article that will help admins clean up their WSUS databases"

As mentioned above, runners up and comments were removed from this post, to fit into the forum's 60,000 character limit.

You will find the complete post, comments and feedback on the main announcement post.

Please join the discussion, add a comment, or suggest future categories.

If you have not yet contributed an article for this month, and you think you can write a more useful, clever, or better produced wiki article than the winners above, here's your chance! :D

Best regards,
Pete Laker

More about the TechNet Guru Awards:


#PEJL
Got any nice code? If you invest time in coding an elegant, novel or impressive answer on MSDN forums, why not copy it over toTechNet Wiki, for future generations to benefit from! You'll never get archived again, and you could win weekly awards!

Have you got what it takes o become this month's TechNet Technical Guru? Join a long list of well known community big hitters, show your knowledge and prowess in your favoured technologies!



Output file to a XSL file and email it

$
0
0

Hello,

I have 5 queries that I want to put in a single SQL Agent job and all of them need to output the results into a single spreadsheet but in 5 different tabs and once the data is output I need the job to send me an email with the spreadsheet as attachment.

Is this possible?

Thanks

Date when a Job Category was created

$
0
0

All,

One of our applications failed when we tested in DR. It turned out that the "User Defined Job Category" was missing in the SQLAgent. We wanted to know when (date) this Category was created as we were unable to back track and investigate who & why it was created in the first place.

I tried querying the system table but was unable to find the date information. 

 SELECT * FROM msdb.dbo.syscategories  

 

Any idea if this date is stored somewhere?

Thanks,

Gopi

"Log File" Error while running a Stored Procedure

$
0
0

Hi, 

We try to run a stored procedure in management studio - and we see the following error - 

"

Executed as user: "Some User". Unspecified error occurred on SQL Server. Connection may have been terminated by the server. 

[SQLSTATE HY000] (Error 0)  The log for database 'Some-database' is not available. 

Check the event log for related error messages. 

Resolve any errors and restart the database. 

[SQLSTATE HY000] (Error 9001)  During undoing of a logged operation in database 'Some-Database', an error occurred at log record ID (2343114:16096:197). 

Typically, the specific failure is logged previously as an error in the Windows Event Log service. Restore the database or file from a backup, or repair the database. 

[SQLSTATE HY000] (Error 3314)  During undoing of a logged operation in database 'Some-Database', an error occurred at log record ID (2342777:81708:1). 

Typically, the specific failure is logged previously as an error in the Windows Event Log service.


Restore the database or file from a backup, or repair the database. [SQLSTATE HY000] (Error 3314).  The step failed. 

"

Can someone please help us with this ?

Thanks

Update Locks Table vs View

$
0
0


Hi, I have the below view 

CREATE VIEW vwEmployee
AS
SELECT TOP 1 ID, DateAdded
FROM DB1.dbo.tblEmployee WITH (UPDLOCK, READPAST)
ORDER BY ID ASC, DateAdded ASC

when I run something like 

begin transaction
select * from vwEmployee
waitfor delay '00:00:05'
commit

usually there has to be update lock on only 1 row in the table. But I see Update lock on each row of the table. When I run the same query on the table

select top 1 * FROM DB1.dbo.tblEmployee WITH (UPDLOCK, READPAST)  ORDER BY ID ASC, DateAdded ASC

I see the update lock is only on 1 row. So what I m missing here? Can someone please shed light on this? Thank you

datetime vs. datetime2 Processing Anomoly in SELECT

$
0
0

Let me preface this with I discovered this issue using JDBC but confirmed it using Transact-SQL as shown below.

Create a single column table with the column being type datetime (compatibility going back years). insert the following dates: '2015-11-01 01:58', '2015-11-01 01:59', '2015-11-01 02:00'

CREATE TABLE [dbo].[testtable](
	[datecol] [datetime] NOT NULL,
 CONSTRAINT [PK_testtable] PRIMARY KEY CLUSTERED
(
	[datecol] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

INSERT INTO [dbo].[testtable] VALUES ('2015-11-01 01:58')
INSERT INTO [dbo].[testtable] VALUES ('2015-11-01 01:59')
INSERT INTO [dbo].[testtable] VALUES ('2015-11-01 02:00')

GO



Now, run the following Transact-SQL

DECLARE @date datetime2 = '2015-11-01 01:59:00.0010000'

SELECT datecol FROM testtable WHERE datecol = @date
INSERT INTO testtable VALUES (@date)

The SELECT will return no rows because there is not a 2015-11-01 01:59:00.001 entry which is correct BUT the INSERT has an error because '2015-11-01 01:59:00.000' already exists, which is also correct.

It appears the SELECT executes converting the datecol values to datetime2 before comparing but the INSERT executes converting the datetime2 to datetime.  This behavior is not correct.  The SELECT should convert the datetime2 value in the WHERE clause to datetime and then do the compares, then this code would work correctly (SELECT would return 1 row because '2015-11-01 01:59:00.001' is converted to '2015-11-01 01:59:00.000' and INSERT would still fail).  Otherwise the INSERT fails when there is no matching key found in the SELECT.

This was tested on SQL 2008 R2.


Pete



After upgrade to SQL 2014 unable to evaluate policies against Registered Servers in CMS

$
0
0

I have a Central Management server set up, I had no issues evaluating policies against the servers I had set up. 

We upgraded from 2012 to 2014 and now I am unable to run\evaluate policies against the registered servers. 

I receive a error:


TITLE: Microsoft SQL Server Management Studio
------------------------------

Value cannot be null.
Parameter name: source (System.Core)

------------------------------
BUTTONS:

OK
------------------------------


==================================

Value cannot be null.
Parameter name: source (System.Core)

------------------------------
Program Location:

   at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)
   at Microsoft.SqlServer.Management.SqlStudio.Controls.ConnectionPropertiesControl.UpdateConnectionInfo()
   at Microsoft.SqlServer.Management.SqlStudio.Controls.ConnectionPropertiesControl.SetConnectionInfo(ConnectionInfoBase connectionInfo)
   at Microsoft.SqlServer.Management.TaskForms.TaskFormControl2005UI.Initialize(TaskFormManager taskFormManager)
   at Microsoft.SqlServer.Management.TaskForms.TaskFormManager.get_Control()
   at Microsoft.SqlServer.Management.TaskForms.TaskFormDialogHost.Microsoft.SqlServer.Management.TaskForms.ITaskFormManagerHost.Initialize(ITaskFormManager control)
   at Microsoft.SqlServer.Management.ActionHandlers.ShowTaskUIDialogActionHandler.RunTaskForm(IContext context)
   at Microsoft.SqlServer.Management.ActionHandlers.DialogBasedActionHandler.RunTaskFormThread(Object contextObject)

I have since attempted to Repair the install

I tried to reinstall\repair just the Management msi.

and someone had mentioned on a different forum to run SP1, we already have SP1, so I ran the latest hot fix

SQL automatic inport and export

$
0
0

good day to all i want only to ask if possible the microsoft sql to be automatic inport and export the database like back up and restore every minutes or seconds or day.

example i have Server A and Server B

I Want the server A to back up and restore to Server B or the other word i want the server A is automatic sysc the database to SERVER B true network. i want to know if possible. 

SERVER A >>>>>sys>>>> SERVER B

other question i want to know also if possible the server A and the Server B sysc together?

SERVER A>>>>> sys >>>>>> SERVER B >>>>sys>>SERVER A

hopefully is possible


Testing DAAS in Azurepack MSSQL

$
0
0

Hi. 

We have implemented Private Cloud based on System Center, Hyper-V, vmware on Dell Server equipment. We've implemented Azurepack (Vm cloud atm) and the next step would be daas (fault tolerant mssql, mysql). My superiours tasked me to deploy 2 separate infrastructure configuration in order to find best (in term of overal perfomance) solution.

1st - VM1, VM2, SQL2014 in always on mode, one big Lun on which vhdx's from always on group reside, OS and SQL on a single vhdx = total 2 vhdx (governor is on in azurepack)

2nd -  VM3, VM4, SQL2014 in always on mode, boot vhdx disks reside on a separate Lun, data (sql, logs etc) disks presented to vms via virtual FC adapters.(governor is on in azurepack)

Also i need to stress test this two configurations and confirm that а) governor actually works b) receive general io perfomance result on both configurations.

my questions:

1. in your opinion what configuration \ setup is the best solution for hosting tenants database? Our proposed configs is okay?

2. Testing io SQL. I've done some research and planning to use sqlio utility. Could you please share your expirience using this tool ? Anything i should be care of ? It would worth mentioning that tenants (our internal users, resourse consumers) failed to provide me any metrics for governor, so i've no clue what to input there ).

<sorry for broken english>

OPENQUERY Max Query is 8 KB

$
0
0

In the books online documentation for the OPENQUERY function,
https://msdn.microsoft.com/en-us/library/ms188427.aspx#Anchor_1
it says :

'query'

Is the query string executed in the linked server. The maximum length of the
string is 8 KB.

Which "KB" is that?  The 8000 limit of the varchar data type?  8 * 1024 = 8192 bytes?  The ~8096 bytes allowed in a SQL Server 2000 Row?

What part of the system is applying that 8 KB limit?


Dan Jameson
Associate Director of IT/DBA
Children's Oncology Group
www.ChildrensOncologyGroup.org


A fatal error occurred while reading the input stream and high ASYNC_NETWORK_IO

$
0
0

We are running a SQL 2005 SP4 in VMWARE vCenter 6.0, the networks card we have tested on the server is E1000 and vmxnet3.

The problem started with that the server started to report “A fatal error occurred while reading the input stream from the network. The session will be terminated.”

After that we got longer response time, a normal sql take up 2 to 3 time longer to respond.  

We started to change the network cards with E1000 to vmxnet3 with not success. The next step was to change the TCP Chimney offloads from on to off. We started with normal problems ppl used describe in different forums and in the kb951013.

This didn’t help us to get rid of the error and it also made the respond time on the server to increase.

If I check the waits on the server we also ASYNC_NETWORK_IO at the number 1 place on the server.

We have tried to

Validate the network components between the application/clients and the SQL Server instance (router, for example).

Look at your NIC configuration on the server to make sure there are no issues with the physical card. Also, check if autodetect is picking the fastest speed.

Check network adapter bandwidth: 1 Gigabit is better than 100 megabits, and 100 megabits is better than 10 megabits.

Is there anybody that know of any problem with combo SQL 2005 SP4 in VMWARE? Or any other general thing to look at.

automatization options?

$
0
0

Hi guys; 

I always found the BEST advice here; that's why I always come back!

Quick inquiry... what do you think? I need to automate a process... a group of people needs to see/receive every 3 weeks a list of 600 rows for 1 field.

Options I see...

1- Create an ssrs with a view... and provide them the link...

2- Sql job that every 3weeks runs a powershell... inside powershell: send the result of the query attached in an email sent to these people...

what do you think? do I have any other option?

thanks in advance guys!!

 

BugCheck Dump - Non-yielding Resource Monitor

$
0
0

Help me!

My ms sql server is crash today.In logs i'm view

I'm have mdmp file.

Current time is 11:45:20 11/02/15.
=====================================================================
       BugCheck Dump
=====================================================================

This file is generated by Microsoft SQL Server
version 10.50.6220.0
upon detection of fatal unexpected error. Please return this file,
the query or program that produced the bugcheck, the database and
the error log, and any other pertinent information with a Service Request.


Computer type is Intel(R) Xeon(R) CPU E5-2670 0 @ 2.60GHz.
Bios Version is VRTUAL - 5001223
BIOS Date: 05/23/12 17:15:53  Ver: 09.00.06
2 X64 level 8664, 10 Mhz processor (s).
Windows NT 6.1 Build 7601 CSD Service Pack 1.

Memory
MemoryLoad = 80%
Total Physical = 2047 MB
Available Physical = 399 MB
Total Page File = 4095 MB
Available Page File = 2497 MB
Total Virtual = 8388607 MB
Available Virtual = 8386265 MB
**Dump thread - spid = 0, EC = 0x0000000000000000
***Stack Dump being sent to C:\db\MSSQL10_50.SQLEXPRESS\MSSQL\LOG\SQLDump0001.txt
* *******************************************************************************
*
* BEGIN STACK DUMP:
*   11/02/15 11:45:24 spid 1816
*
* Non-yielding Resource Monitor
*
* *******************************************************************************
* -------------------------------------------------------------------------------
* Short Stack Dump                   
Viewing all 15930 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>