sql-server-2012

Combine Multiple Record Types in SSIS Data Flow

邮差的信 提交于 2019-12-23 05:08:27
问题 I can use Integration Services to extract and transform data that is, for example, contained in a single type of fixed format record in an import flat file. I can also handle multiple types of fixed format records in a single file, as long as I am able to send them to different destinations. But what if I need to associate two (or more) records from an input file for each record that is going to a single destination? The only way I know that these records belong together is that they occur

Normalize a table with tightly coupled data

白昼怎懂夜的黑 提交于 2019-12-23 04:52:18
问题 I currently have a table that stores the materials used to create an item Item (material1, material2, material3) Another material has recently been added. However, I want to normalize this table so that in the future, adding a new material won't need a new column to be added to the database. I extracted the materials into the following junction table ItemJuncMaterial (id, itemId, materialid) However, the catch is that the order of the materials matter. So this junction table won't allow me to

Sql query to generate monthly pay dates within a date range

≡放荡痞女 提交于 2019-12-23 04:45:21
问题 I want to generate monthly pay dates based on a given date and date range.Suppose I have selected "01/30/2016" as a starting pay date and date range is the year 2016.Then the pay dates will be (total days of month -1) th of other months throughout the year 2016. I have added a screenshot for the result set for the pay date "01/30/2016". I want to know the query in SQL. Any help will be appreciated. 回答1: You can as the below: DECLARE @SelectedDate DATETIME = '2016.01.30' SELECT DATEADD(DAY, -1

How to open SQL Server 2012 using run prompt [closed]

十年热恋 提交于 2019-12-23 04:43:31
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . I am using SQL Server 2008 R2 and SQL Server 2012. How should I specify whether I have to open SSMS 2008 R2 or SSMS 2012 using run prompt when I run SSMS? Let's say for now I have to open SSMS 2012 using the RUN

SQL Agent 2012 fails with error code : 0x00000001 however SQL Agent 2008 successfully executes for the same package

三世轮回 提交于 2019-12-23 04:26:35
问题 I have tried to execute a package containing script component which uses Excel Component in SQL Agent 2012 but has failed with Code: 0x00000001 Source: Backlog Supplies Validation Description: Exception has been thrown by the target of an invocation. End Error DTExec: The package execution returned DTSER_FAILURE (1) However when I call the same package via SQL Agent 2008 R2 initially it failed with error code : 0x00000001 . Later it succeeded after creating a folder with name "Desktop" in the

SQL deadlock with select/update operations on a table

送分小仙女□ 提交于 2019-12-23 04:23:26
问题 I have changed the column(prod_id) datatype "nvarchar(25)" to "varchar(50)" then parallel DML operations are failing with deadlock. The table involved in deadlock - "tbl_Ref_Attr_Prod_Team " Indexes on table Indexes on table Here is the select/update deadlock xml.. <deadlock> <victim-list> <victimProcess id="process3980de4558" /> </victim-list> <process-list> <process id="process3980de4558" taskpriority="0" logused="0" waitresource="PAGE: 7:1:1660625 " waittime="966" ownerId="635070687"

SQL Server float data type understanding

允我心安 提交于 2019-12-23 04:21:46
问题 https://msdn.microsoft.com/en-us/library/ms173773%28v=sql.110%29.aspx After I insert a value (0.12346789123456789123456789) for example in the table that has a float type column, I query and get back 0.1234567891234568 which contains 17 digits. I have 3 questions How can I back track the binary representation of the input and output ? The document says it uses 53 bits as default. I am using SQL Server Management Studio and I don't know how to specify n value during declaration of my column

Using jTDS to connect to SQL Server 2012 availability group listener

对着背影说爱祢 提交于 2019-12-23 03:35:12
问题 I am working on a legacy project that uses jTDS to connect to SQL server. The client wants us to support SQL Server 2012 AlwaysOn. one key requirement is the ability of our application to automatically reconnect to secondary server in event of failover. unfortunately, jTDS 3.0 does not support AlwaysOn. I have 2 options use MS JDBC (http://www.microsoft.com/en-us/download/confirmation.aspx?id=11774) Write a wrapper that returns the connection string after checking the status of the active

Using STCrosses() with a Spatial Index in SQL Server

三世轮回 提交于 2019-12-23 03:22:45
问题 Does The Microsoft StCrosses() function for Geography data support Spatial Index? When I try to execute this function with Spatial Index I get this error message: "The query processor could not produce a query plan for a query with a spatial index hint. Reason: Spatial indexes do not support the method name supplied in the predicate. Try removing the index hints or removing SET FORCEPLAN" 回答1: No. Indexing spatial data is nontrivial, and the class you are discussing can contain arbitrarily

Is there a way to easily convert a flat DataTable to a nested .NET object?

冷暖自知 提交于 2019-12-23 03:12:57
问题 I have a large hand tuned SQL query that returns a flat data table with many (>25) columns. Currently, I manually convert that to a .NET object with three levels of nesting (i.e. an object which contains (among other properties) a list of further objects which contains (among other properties) a list of further objects. Is there anything with the ease of something like AutoMapper which can convert a DataTable into a target .NET object, even if its nested? 回答1: I am the original poster of this