Microsoft distributes Microsoft SQL Server 2008 R2 Service Pack 2 fixes as one downloadable file. Because the fixes are cumulative, each new release contains all the hotfixes and all the security fixes that were included with the previous SQL Server 2008 R2 Service Pack 2 fix release.

Symptoms

Consider the following scenario:

  • You have a partitioned table that uses a datetimeoffset type column as a partitioning column in Microsoft SQL Server 2008 R2.

  • You use the New Publication Wizard to create a snapshot publication of the partitioned table in SQL Server Management Studio (SSMS).

In this scenario, you receive the following error message in one of the scripts that is used to create the snapshot publication. The scripts are automatically generated by the New Publication Wizard.

Msg 102, Level 15, State 1, Line 3Incorrect syntax near ''.

Note For a detailed example scenario in which this issue would occur, refer to the "More Information" section.

Resolution

Cumulative update information

Cumulative Update 5 for SQL Server 2008 R2 SP2

The fix for this issue was first released in Cumulative Update 5. For more information about how to obtain this cumulative update package for SQL Server 2008 R2 SP 2, click the following article number to view the article in the Microsoft Knowledge Base:

2797460 Cumulative update package 5 for SQL Server 2008 R2 Service Pack 2Note Because the builds are cumulative, each new fix release contains all the hotfixes and all the security fixes that were included with the previous SQL Server 2008 R2 SP 2 fix release. We recommend that you consider applying the most recent fix release that contains this hotfix. For more information, click the following article number to view the article in the Microsoft Knowledge Base:

2730301 The SQL Server 2008 R2 builds that were released after SQL Server 2008 R2 Service Pack 2 was released

More Information

Assume that you create a partition function in SQL Server 2008 R2, and that the data type of input_parameter_type is datetimeoffset. Then you use Script Partition Function as in SSMS. In this scenario, the issue that is described in the "Symptoms" section occurs. Additionally, the date-literal range values generated by SSMS are not quoted in single quotation marks.For example, you execute the following statement to create a partition function:

CREATE PARTITION FUNCTION PF_TEST (datetimeoffset(7)) as range right for values('20100101', '20100201', '20100301')

Then, you right-click the partition function in the Object Explorer, select Script Partition Function as, select Create To, and then select New Query Editor Window in SSMS. You see the following generated script:

CREATE PARTITION FUNCTION [PF_TEST] (datetimeoffset(7)) AS RANGE RIGHT FOR VALUES (1/1/2010 12:00:00 AM +00:00, 2/1/2010 12:00:00 AM +00:00, 3/1/2010 12:00:00 AM +00:00)If you try to run the generated script, then you receive the following error message:

Msg 102, Level 15, State 1, Line 3Incorrect syntax near '12'.

Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.