Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Development - SQL Server 2014 » Latest topics
Browsing all 3145 articles
Browse latest View live

looking for a set based solution

Scenario:I have a set of agreements that have a date the agreement was started. From those agreements I track activities that occur during 3 month periods starting from the start date. I calculate...

View Article


unpivot

CREATE TABLE [dbo].[TestTbl1]( [Name] [varchar](50) NULL, [col1] [int] NULL, [col2] [int] NULL, [col3] [int] NULL, [col4] [int] NULL) ON [PRIMARY]GOINSERT [dbo].[TestTbl1] ([Name], [col1], [col2],...

View Article


import from excel to sql more than 255 columns

Hello,I have so many excel files coming that I need to load to sql and create automated process.I dont want to convert them to csv or txt file format and then load to sql. I also dont want to use...

View Article

Ignoring a non-existent table

Hi,I've been thinking about this for a while and I can't seem to come up with a viable solution. I have a situation where some tables are named with years (e.g., Sales_2010, Sales_2011, Sales_2012,...

View Article

Deadlock on a "queued DELETE"

All, could someone help me how to avoid the deadlock on a "queued" DELETE operation? It seems SQL server has some issue. We avoided by doing a RETRY with a considerable amount of time, about 0.4...

View Article


Select Max Value of a Summed Column With Priority Assignments

I have a feeling this might end up being a simple solution but I'm spinning my wheels on it and it is driving me crazy. Here are some dummy tables I'm dealing with:NameFrequency[code="plain"]Name Role...

View Article

use dynamic table whiile dynamic pivot

Hi,I want to use different table name every time while transpose data in my dynamic query[code="sql"]DECLARE @colsUnpivot AS NVARCHAR(MAX),@TableName NVarchar(MAX),@query AS NVARCHAR(MAX),@colsPivot as...

View Article

Select continual date ranges from a list that overlaps

Hi There, need some help.I have list of prices and the dates they are valid from and to. For Example:Date From Date To Price20/06/2013 26/08/2013 199.9927/08/2013 21/01/2014 199.993/10/2013 31/10/2013...

View Article


PLEASE HELP ****** Stripping #s from one column to update 2 columns *******

Hi-Can you please help me figure out why my results are duplicating. Original field looks like this 7 1601081408920063I would like to take 7 and update another field with it, Than I would like to take...

View Article


choosing multiple options

Hi, I have a table and I am having a hard time understanding how to write the code. :w00t:The final user needs to be able to choose the following.one or many "population"one or many indicators, meaning...

View Article

Transaction Not commiting when run on wrong DB

The transaction is not getting commited or rollback when run in different db. The execution might throw error but its not commiting for below BEGIN TRY BEGIN TRANSACTION UPDATE dbo.test SET Arrival=...

View Article

PIVOT Table Help

Hello,I am trying to create a PIVOT table to list employee by location. I want to show my list with the Location and have two additional columns that will list Employee IDs. Below is my code and I...

View Article

rebuild indexes and statistics n reporting server

Using SQL Server 2014 enterprise edition.I rebuild indexes and statistics on my database on the load server daily after data load, before I take a backup and restore this db on reporting server. Do I...

View Article


Bulk Insert SQL Express 2014 Fails at Float value

Hello All,Trying to do bulk insert in SQL 2014 Express but receiving an error. Seems like the process fails on the first float value of the table it is uploading to.I am using excel office 2013 and...

View Article

SQL Server 2014 Developer edition

I am quite sure I came across a blog or some article in the last six months mentioning that SQL Server 2014 Developer Edition is now free.I can't seem to find the download. If you know where to get...

View Article


Case when then dateadd getdate question

Morning folks,I've a field with a date of birth in it.Displayed as YYYY-MM-DDEx: 1990-08-19I would like to use CASE, WHEN, THEN, END AS for this.CASE Person.dobWHEN <= DATEADD(YEAR, -13, GETDATE())...

View Article

Splitting a multi-delimiter string and update

So I am trying to fix something a developer did in our database and I'm having trouble figuring this out. First about the string itself. It is a double delimited string, the first value is a text...

View Article


Need to restore 700+ DBs without any data

Hey all, I have a bit of a situation and wondering if someone can help me. I have 700+ DBs in QA which I need to restore (without the data) in DEV. Dev team needs just the structure and not any data in...

View Article

Pro rata monthly budget by week

I need to pro-rata a monthly budget so that a greater proportion is allocated to beginning of month.They want it to be:working days 1-5 = 40% of total budget6-10 = 30%10-15 = 20%15+ = 10%There is a...

View Article

Looping through rows and applying a count

Hi, I was hoping I could get some help for the below that I'm trying to return. I'm a SQL Server newbie! i have a table that can be recreated with the below:create table stat(gameID int,playID int,name...

View Article
Browsing all 3145 articles
Browse latest View live