sql-server-2012

Installing SQL Server 2012 error “The system cannot open the device or file specified.”

扶醉桌前 提交于 2019-12-10 19:49:31
问题 I am trying to install SQL Server 2012 Developer on my machine which already has SQL Server 2008 R2 Express with Windows 7. I used Microsoft Secure Download Manager for downloading installer and it automatically convert installer file to ISO file. I am using WinRAR to unzip the ISO file and running setup on installation I got below error message: Unable to open Windows Installer file 'C:\SQLSErverInstaller\x64\setup\sql_engine_core_inst_msi\sql_engine_core_inst.msi'. Windows Installer error

Returning varchar(max) Output parameter from stored procedure truncating to 4000 characters

三世轮回 提交于 2019-12-10 19:23:32
问题 I've got a classic ASP appln with a SQL2012 database. I recently changed a table column from varchar(8000) to varchar(max) as it wasn't big enough to store the required data. I can update the column with all of the data I need to store, but the SP I use to return the column data as an output parameter is only returning 4000 characters (at least that is what the result of the following code is giving me: Len(cmd.Parameters("@detail").Value) I'm using the following parameter declaration as part

When to use the table operator APPLY

时间秒杀一切 提交于 2019-12-10 18:57:17
问题 I'm trying to understand the table operator APPLY . Here is the example: CREATE TABLE #y ( Name char(8), hoursWorked int); GO INSERT INTO #y VALUES ('jim',4); INSERT INTO #y VALUES ('michael',40); INSERT INTO #y VALUES ('raj',1000); INSERT INTO #y VALUES ('jason',7); INSERT INTO #y VALUES ('tim',50); GO CREATE TABLE #x ( Name char(8),game char(8), NumBets int); GO INSERT INTO #x VALUES ('jim','chess',4); INSERT INTO #x VALUES ('jim','BG',10); INSERT INTO #x VALUES ('jim','draughts',100);

Opening FileTable Files in c# / .net 4

一笑奈何 提交于 2019-12-10 18:33:46
问题 I have a Filetable containing many different document types (.doc;.pdf;.xls etc). I am writing a small web (C# / .net 4) search app. Search works great using fulltext index with filetable to find content. But I'm struggling to find a way in my app to have the search results as links which can launch the document in question? And just handle the different file types? (Assume client has Word/adobe/excel installed etc) Grateful for any advice. 回答1: You will need to write a custom page handler to

Conversion of C# datetime to sql server datetime is throwing an error

a 夏天 提交于 2019-12-10 18:33:22
问题 In C# a DateTime property with value {27-01-2017 12.00.00 AM} is being passed in a data table to a procedure with an UTT parameter. UTT also has the same datatype datetime. I am using the generic method provided below. I cannot explicitly convert data type. Error : The conversion of a nvarchar data type to a datetime data type resulted in an out-of-range value. The data for table-valued parameter @UttParameter doesn't conform to the table type of the parameter. SQL Server error is: 242, state

Create column which increases from last index [duplicate]

独自空忆成欢 提交于 2019-12-10 18:30:04
问题 This question already has answers here : How do I add string with auto increment value in SQL Server? (3 answers) Closed 4 years ago . I need to generate a column for InvoiceID. and I want to keep the formate of this column like this INV0000001, INV0000002, . . . . INV0000010, INV0000011, . . and so on. As you can see this column is increasing with last index. How can i do this. I'm using SQL Server 2012. I have searched, but couldn't find, how to increase a number like this. 回答1: Try using

Insert using a Sequence as generator for a Primary Key value in Entity Framework

房东的猫 提交于 2019-12-10 18:24:48
问题 I have a sequence that looks like this: CREATE SEQUENCE dbo.NextWidgetId AS [bigint] START WITH 100 INCREMENT BY 2 NO CACHE GO And a table that looks like this: CREATE TABLE [dbo].[Widget_Sequenced] ( [WidgetId] [int] NOT NULL DEFAULT(NEXT VALUE FOR dbo.NextWidgetId), [WidgetCost] [money] NOT NULL, [WidgetName] [varchar](50) NOT NULL, [WidgetCode] [int] NOT NULL, [LastChangedBy] [int] NOT NULL, [RowVersionId] [timestamp] NOT NULL, CONSTRAINT [PK_Widget_Sequenced] PRIMARY KEY CLUSTERED (

How to Show Zero Count in SQL SERVER Query

旧巷老猫 提交于 2019-12-10 18:06:36
问题 I want to know that how we can display ZERO count? I have only one table and I am doing monthly count but some how 1 month doesn't have any rows and SQL Server is skipping that month during count but I need to show in my report. This is my query that I am using: SELECT MONTH(createdDate) [Month], ISNULL(COUNT(id), 0) [Count] FROM [PocketLife].[dbo].[Notifications] WHERE description = 'Welcome to Pocket Link' AND YEAR(CAST(createdDate as DATE)) = YEAR(GETDATE()) GROUP BY MONTH(createdDate)

What's the difference between filtering in the WHERE clause compared to the ON clause?

蓝咒 提交于 2019-12-10 17:51:01
问题 I would like to know if there is any difference in using the WHERE clause or using the matching in the ON of the inner join. The result in this case is the same. First query: with Catmin as ( select categoryid, MIN(unitprice) as mn from production.Products group by categoryid ) select p.productname, mn from Catmin inner join Production.Products p on p.categoryid = Catmin.categoryid and p.unitprice = Catmin.mn; Second query: with Catmin as ( select categoryid, MIN(unitprice) as mn from

Multiple Update Statement in SQL Server MERGE

主宰稳场 提交于 2019-12-10 17:29:35
问题 SQL Server Version : Microsoft SQL Server 2012 - 11.0.2218.0 (x64) I got the following exception when I ran this Query. Exception : An action of type 'WHEN MATCHED' cannot appear more than once in a 'UPDATE' clause of a MERGE statement. I know that the exception was for more than once Update statement in Merge Statement. would you please suggest me that how I achieve the following SQL Query logic? Based on One column, When Matched and column is not null then update only one different column.