sql-server-2012

Using COUNT and Return Percentage Against SUM of Records

浪尽此生 提交于 2020-01-06 21:37:53
问题 Pretty simple question I suppose, but I can't find the answer on here! I am trying to calculate the volume of records based on a WHERE clause, as well as return a percentage of those records based on the same where clause. The percentage would be calculated against the total amount of records in the database. For example, I count all my records that meet "MyCondition": SELECT COUNT(*) FROM [MyTable] WHERE Condition='MyCondition' This works fine. However, how does one take that count, and

designing new table for daily uploads - use unique constraint

*爱你&永不变心* 提交于 2020-01-06 20:38:07
问题 I am using SQL Server 2012 & am creating a table that will have 8 columns, types below datetime varchar(12) varchar(6) varchar(100) float float int datetime Once a day (normally) there will be an upload of approx 10,000 rows of data. Going forward its possible it could be 100,000. The rows will be unique if I group on the first three columns listed above. I have read I can use the unique constraint on multiple columns which will guarantee the rows are unique. I think I'm correct in saying

Correct parameter types for select queries that use table valued functions

可紊 提交于 2020-01-06 20:18:09
问题 My SQL Server 2012 contains a function Get_Schedule : CREATE FUNCTION Get_Schedule( @pProject_Id AS INT, @pPeriod_Start AS DATETIME2, @pPeriod_End AS DATETIME2) RETURNS TABLE WITH SCHEMABINDING AS RETURN ( SELECT 42 AS Val1, 'Foo' AS Val2); Visual Studio 2015's SQL Server Object Explorer shows the function parameters with the types as defined. However when dragging the function to the strongly typed dataset designer the DATETIME2 parameters are changed to ANSISTRING instead of System.DateTime

Converting rows to column in SQL Server

三世轮回 提交于 2020-01-06 19:35:21
问题 I have a table user_travel with this sample data in it: I want a query which returns the output shown below, with the help of the Visit column for each user ID .. Expected output id FromD-1visit ToD-1visit FromD-2visit ToD-2visit FromD-3visit ToD-3visit UserID ------------------------------------------------------------------------------------- 1 2017-05-17 2017-05-17 2016-02-02 NULL 2016-02-01 2016-02-09 2 Here FromD and ToD are FromDate and ToDate (columns) I've also tried using PIVOT but

Installation wizard shows its success , however, SSIS Package is not getting installed

喜欢而已 提交于 2020-01-06 17:48:01
问题 I have both SQL Server 2008 R2 and 2012 both installed on same server. My SSIS package is developed by BI studio 2008 R2. I have created package manifest file for the installation. As both SQL Server 2008 R2 and 2012 installed, when I run command: H:\>where dtsinstall.exe it returns these 3 details: C:\Program Files\Microsoft SQL Server\100\DTS\Binn\dtsinstall.exe C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\dtsinstall.exe C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn

Installation wizard shows its success , however, SSIS Package is not getting installed

烂漫一生 提交于 2020-01-06 17:46:33
问题 I have both SQL Server 2008 R2 and 2012 both installed on same server. My SSIS package is developed by BI studio 2008 R2. I have created package manifest file for the installation. As both SQL Server 2008 R2 and 2012 installed, when I run command: H:\>where dtsinstall.exe it returns these 3 details: C:\Program Files\Microsoft SQL Server\100\DTS\Binn\dtsinstall.exe C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\dtsinstall.exe C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn

Visual studio debug access to external database

夙愿已清 提交于 2020-01-06 16:29:30
问题 I have a question as to how the Visual Studio 2013 debug emulator for Web API works. I had built a Web API project in Visual Studio 2013 to access a database on an external server. The code was built using VS2013's ASP.NET Web Application project template for a Web API application. Once built, running debug opened a browser window for localhost port 56618, which allowed access from Fiddler to test Http requests. Once I had the project finished, I published it to a website using Web Deploy to

Deployment of SSRS 2012 From SSDT Fails - The specified report server URL could not be found

為{幸葍}努か 提交于 2020-01-06 15:49:10
问题 I have recently installed SQL Server 2012 Developer on my laptop. I created a simple SSRS report using AdventureWorks201. The report builds fine but will not deploy. I get the error "The specified report server URL http:/localhost/Reports_MSSQLSERVER2012 could not be found" I am able to browse to said URL without issue. I can even upload the report and run it just fine. I am using an administrator account in both cases (on the URL and within SSDT). Is there some reason why SSDT cannot see the

Deployment of SSRS 2012 From SSDT Fails - The specified report server URL could not be found

和自甴很熟 提交于 2020-01-06 15:49:09
问题 I have recently installed SQL Server 2012 Developer on my laptop. I created a simple SSRS report using AdventureWorks201. The report builds fine but will not deploy. I get the error "The specified report server URL http:/localhost/Reports_MSSQLSERVER2012 could not be found" I am able to browse to said URL without issue. I can even upload the report and run it just fine. I am using an administrator account in both cases (on the URL and within SSDT). Is there some reason why SSDT cannot see the

ssas mdx line quantity divided by SUM

走远了吗. 提交于 2020-01-06 13:29:31
问题 How do I create the new column in MDX? The dimensions selected are not important. I just want the line amount / sum for the data selected. I am not an mdx expert... Current code below : CREATE MEMBER CURRENTCUBE.[Measures].[Weight] AS IIF([Measures].[Sales Line Amount AC Budget hidden] <> 0, Divide([Measures].[Sales Line Amount AC Budget hidden] ,AGGREGATE(Root(),[Measures].[Sales Line Amount AC Budget hidden])),NULL), VISIBLE = 1 , ASSOCIATED_MEASURE_GROUP = 'Sales Forecast' ; Hi they are