sql-server-2014

Stored Procedure with access VBA Button

无人久伴 提交于 2019-12-13 02:56:39
问题 I need to execute a stored procedure in MS Access 2013. I use Access as front end interface which is connected to two databases. One database has a few stored procedures. I need to execute those with push of button in the Access. Database is connected through SQL Server authentication. I started a button in Access and here is the VBA code behind this button. It's empty and just simply need more code to get it running: Private Sub UpdateItems_Click() End Sub Here are the parameters to

Create new table from query results

不羁的心 提交于 2019-12-13 02:41:42
问题 I am attempting to create a new table from the results a query. I've attempted select into, also have attempted create table. I've attempted select into, also have attempted create table. This is my original code, I am attempting to create a new table from the output of this code called 'InitialJoinwithCPCL' select * from [dbo].[Combined] as a left join [dbo].[CPCL] as b on a.[StateAbbr] = b.[ST] and a.[CropName] = b.[CROPNAME] where cropyear <> 2019 and (policynumber is not null) and

Is there a C# API for sys.tables and sys.procedures?

南楼画角 提交于 2019-12-13 02:30:08
问题 Before I run off and write my own version from scratch, is there an API that exposes the system views in SQL Server (e.g. sys.tables and sys.procedures) to C#? 回答1: As you suggest, you can use ADO.NET to query the system catalogs. You could also use LINQ to SQL: Open Server Explorer in Visual Studio. Open a connection to the server. Right-click the server and choose Change View > Object Type. Under System Tables and User Tables, you can drag a system object onto a .dbml surface. For database

How can I move data from one column of a parent into a new child table?

二次信任 提交于 2019-12-13 01:24:57
问题 I have two tables: WordForm and WordDefinition: CREATE TABLE [dbo].[WordForm] ( [WordFormId] VARCHAR (20) NOT NULL, [WordId] VARCHAR (20) NOT NULL, [Primary] BIT DEFAULT ((0)) NOT NULL, [PosId] INT NOT NULL, -- I want to move text data from this column into -- the WordDefinition table column called Definition -- and then I will remove the column from here later. [Definition] VARCHAR (MAX) NULL, [Sample] VARCHAR (MAX) NULL, [Synonym] VARCHAR (100) NULL, PRIMARY KEY CLUSTERED ([WordFormId] ASC)

filtering any columns of a database table client T-SQL select from case when then where

半城伤御伤魂 提交于 2019-12-12 19:06:29
问题 I would like to be able filter through the columns of a datagrid but don't know how to fix the select statement this is as far as I could get SELECT ClientID, FirstName, LastName, BirthDate, StreetName, City, State, ZipCode, CellPhone FROM dbo.Client CASE WHEN @ColumnName = 'ClientID' THEN WHERE @ColumnName = @Filter END CASE WHEN @ColumnName = 'FirstName' THEN WHERE @ColumnName LIKE @Filter END CASE WHEN @ColumnName = 'LastName' THEN WHERE @ColumnName LIKE @Filter END CASE WHEN @ColumnName =

Reference one foreign key to multiple primary keys in SQL Server 2014

百般思念 提交于 2019-12-12 13:41:42
问题 I have three tables in my database. MedicalTest [MedicalTestID PK] SportTest [SportTestID PK] GeneralNeeds [GeneralNeedsID PK] Inside GeneralNeeds there is ProcessID which needs to keep MedicalTestID and SportTestID GUID. As soon as I insert an existing GUID from either tables I get "Conflict" error message which I believe it means the given GUID doesn't exist in the other table. For example: If I insert the GUID from MedicalTest then it will tell me that the SportTest doesn't have the given

HTML Escape in T-SQL SQL Server 2014

匆匆过客 提交于 2019-12-12 12:51:44
问题 I have a column in a SQL Server database that stores a text block in the following fashion: <HTML><HEAD><style type="text/css">BODY,TD,TH,BUTTON,INPUT,SELECT,TEXTAREA{FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial,Helvetica;}BODY{MARGIN: 5px;}P,DIV,UL,OL,BLOCKQUOTE{MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px;}</style></HEAD><BODY> <p style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px">Patient is a 84 year old female.  Patient's histpry includes the following:</p> <p style="MARGIN-TOP: 0px; MARGIN-BOTTOM:

Divide rows with date in SQL Server 2014

一曲冷凌霜 提交于 2019-12-12 10:43:04
问题 I have a problem with SQL. I have the following table: declare @t table (START_DATE datetime, END_DATE datetime, GROSS_SALES_PRICE decimal(10,2) ); insert into @t values ('2014-08-06 00:00:00.000', '2014-10-06 23:59:59.000', 29.99), ('2014-09-06 00:00:00.000', '2014-09-09 23:59:59.000', 32.99), ('2014-09-10 00:00:00.000', '2014-09-30 23:59:59.000', 32.99), ('2014-10-07 00:00:00.000', '2049-12-31 23:59:59.000', 34.99) I would like to separate the dates which overlaps. For example I have in the

Temp table in stored procedure is unavailable after first GO

时间秒杀一切 提交于 2019-12-12 09:26:26
问题 I have 140,000 INSERT statements I need to run. I am trying to insert the record's into a database table, and then input the created PK's into a temp table which I then return. It looks something like this: CREATE PROCEDURE sp_MassInsertProcedure @PassInVariable int AS CREATE TABLE #TempTable(OriginalID int IDENTITY(1,1), NewID int); --These two inserts are essentially repeated 70,000 times INSERT INTO MyDBTable (something, something, something) VALUES (1, 2, @PassInVariable); INSERT INTO

Will Visual Studio 2008 Reporting Services work with SQL Server 2014?

百般思念 提交于 2019-12-12 06:20:48
问题 Will Visual Studio 2008 Reporting Services work with SQL Server 2014? If not, should the report solutions be upgraded to the latest version of Visual Studio? Which versions of Visual Studio Reporting Services work with SQL Server 2014? 回答1: The relationship between Visual Studio and SQL Server can be a bit confusing. Reporting Services (the report server platform) is a component of SQL Server . Reporting Services reports can be designed using Microsoft's development environment tool Visual