sql-server-2008-r2

In SQL Server bulk insert, how do I use higher ASCII characters for Field and Row terminators

让人想犯罪 __ 提交于 2019-12-12 03:17:54
问题 I have a bulk insert that works on SQL Server 2000 that I'm trying to run on SQL Server 2008 R2, but it's not working as I had hoped. I've been successfully running these bulk inserts into SQL 2000 with the following: Format file: 8.0 9 1 SQLCHAR 0 0 "ù" 1 Col1 "" 2 SQLCHAR 0 0 "ù" 2 Col2 "" 3 SQLCHAR 0 0 "ù" 3 Col3 "" 4 SQLCHAR 0 0 "ù" 4 Col4 "" 5 SQLCHAR 0 0 "ù" 5 Col5 "" 6 SQLCHAR 0 0 "ú" 6 Col6 "" 7 SQLCHAR 0 0 "" 0 Col7 "" 8 SQLCHAR 0 0 "" 0 Col8 "" 9 SQLCHAR 0 0 "" 0 Col9 "" Data file:

Query to identify contiguous ranges

泄露秘密 提交于 2019-12-12 03:16:53
问题 I'm trying to write a query on the below data set to add a new column which has some sort of "period_id_group". contiguous new_period row_nr new_period_starting_id 0 0 1 0 1 1 2 2 1 0 3 0 1 0 4 0 1 1 5 5 1 0 6 0 What I'm trying to get is: contiguous new_period row_nr new_period_starting_id period_id_group 0 0 1 0 0 1 1 2 2 2 1 0 3 0 2 1 0 4 0 2 1 1 5 5 5 1 0 6 0 5 The logic is that for each 0 value in the new_period_starting_id , it has to get the >0 value from the row above. So, for row_nr =

Security Principals missing in SQL Server 2008 R2

别说谁变了你拦得住时间么 提交于 2019-12-12 03:14:04
问题 SQL Server 2008 R2 on Windows Server 2012 R2, none of the built in security principals are appearing when trying to view user accounts and assigning permissions. They are available on the service to assign the LOGON as value. Specifically I am looking for NETWORK SERVICE . FOR CLARIFICATION: I am referring to the local accounts IUSER , NETWORK SERVICE , LOCAL SYSTEM , etc. I just completed a parallel installation on a demo server with no issues both 2012 R2 boxes. The one with issue is a VM.

How to select multiple columns values same rows from single table

倾然丶 夕夏残阳落幕 提交于 2019-12-12 03:09:56
问题 I have a SQL Server table. Now this table has columns like primary key Id , A, B, C, D, E, F, G Now I want to select rows from this table like this A=A, B=B, C=C, D=D and G > 132 So I am trying to select rows from this table which rows A,B,C,D columns has same data and G column data > 132. So how can I do that ? Thank you. I tried this query but returning same Id rows SELECT TableA.Id,TableA.UserId,TableA.MaximumHp,TableA.Attack,TableA.Defense,TableA.SpAttack,TableA.SpDefense,TableA.Speed

SQL Server trigger update data in to table but should update data only when customer doing insert or update one client

巧了我就是萌 提交于 2019-12-12 02:26:26
问题 Right now trigger looks like this and it works partly My trigger looks like this ALTER trigger [dbo].[tr_EligebilityCheck] on [dbo].[Clients] for INSERT,update as BEGIN UPDATE Clients SET StatusID = 5 WHERE ClientID IN (Select ClientID from Clients c join inserted --ADD THIS JOIN on inserted.ClientID = c.ClientID join IncomeEligibility i on c.HshldSize = i.HshldSize where StatusID in (1,2) and WIC = 0 and (c.CategCode = 'SR' and ((MonthlyYearly = 'month' and c.AnnualHshldIncome >= i.SeniorMo)

Change the context with Subselect MDX from Excel client

纵饮孤独 提交于 2019-12-12 02:24:55
问题 I have two time dimensions, production period and accounting period, and a measure that I want to aggregate with either dimension but not with both when users query the cube from excel. To do that I created a flag measure to check if both dimensions are being used CREATE MEMBER CURRENTCUBE.[Measures].[AcctProdFlag] AS IIF ( [DIM Accounting Period].[Accounting Period Hierarchy].CURRENTMEMBER.level.ordinal <> 0 and [DIM Production Period].[Production Month Hierarchy].currentmember.level.ordinal

SSRS 2008 dynamic Parameters

╄→гoц情女王★ 提交于 2019-12-12 02:05:47
问题 . We are currently using MS SQL server 2008 R2 along with SSRS 2008. I am creating a report with several parameters for users to insert data into a table. Staff_Name that is filled with a SP. Client_Name that is filled based on the Staff_Name choice from a SP. The user will pick the option of 'New Service' or a service already inserted prieviously by the user. Textboxs and date fields that the user will enter data to be inserted into the Table. What I would like the report to do is when the

Entity Model - How to use Database's Default Column Values while inserting

吃可爱长大的小学妹 提交于 2019-12-12 02:03:49
问题 I am using SQLServer 2008, WebForms, C#, Frameowrk 3.5, Entity Framework 1 I generated entity model from DB. My DB has various tables & lets take example of one table user It has fields id, name, email, created_on, is_active, is_on_leave default values for is_active and on_leave properties are default to 0 ( zero ) in db But When I try to insert a record in this table using entity model, it saves NULL in these fields. How to avoid this? I don't want to set a value for them from my page and

how to accomplish this?

最后都变了- 提交于 2019-12-12 01:50:52
问题 having below data with below format CREATE TABLE [dbo].[Sample]( [CCMPNY] [varchar](2) NOT NULL, [CCUST#] [numeric](7, 0) NOT NULL, [RDDYSR] [varchar](7) NOT NULL, [CBLNAM] [varchar](30) NOT NULL, [CCYCLE] [varchar](2) NOT NULL, [RDSIZE] [varchar](2) NOT NULL, [RDCHGC] [varchar](2) NOT NULL, [RDDAY] [numeric](1, 0) NOT NULL, [RDROUT] [varchar](4) NOT NULL, [RDQTY] [numeric](5, 0) NOT NULL how can I get below layout Columns Marked in red FREQ: "Count" of Days in "RDDYSR" field LIFTS: "Lifts" =

sumifs on excel linked sql server query with date

左心房为你撑大大i 提交于 2019-12-12 01:47:10
问题 I'm having no luck being able to do sumifs or countifs on a cell range that is linked to an MS SQL server 2008R2 view when using the date column as a criteria. If it is done on a native table link they works fine but it appears that the query delivers date as text, so.. I've tried formatting the output of the query using convert but it is still a text output tried using datevalue function within the sumifs in excel but doesn't seem to work on ranges same goes for text function Short of