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

Plan guide on delete from

Hello,Is possible to add plan guide with delete from statement?Example:EXEC sp_create_plan_guide @name = N'[PlanGuide-20170510-144208]', @stmt = N'DELETE FROM MyTable WHERE id=@P1', @type = N'SQL',...

View Article


Help with joining to a table with "wildcard" data

I apologize up front as I'm not going to describe very well what I'm attempting to do.  I hope that if you look at the attached script, you will get a better sense.  But I have a code lookup table that...

View Article


OPENQUERY within CASE Statement - It may just be too much for TSQL

I'm looking for guidance.  This is on a SQL 2014 server.I want to create a view that takes two columns, Domain00, and Account00, from one table and add a 3rd column, distinguishe

View Article

Usable Features in Compatability Mode 100

Hi SSC,We've recently upgraded to using SQL 2014 up from 2008 (hooray!). I've been told we're planning to keep the compatibility level at 100 though for the foreseeable future because of "things like...

View Article

SQL Sla calculation excluding weekends and holidays

Good afternoon,I tried to do sql query where is temp table for holidays and then calculation for working days sla hours.Sla hours works (maybe) but when I try use calendar, all values goes wrong. The

View Article


Match a table with sub-total values to its detail value table

I have two tables one with details (Date & Value) & the other with sub totals (Date, SubTotalValue & Referance). I'm searching for a way to match these two by going backward from sub total...

View Article

Removing Brackets Along with Text from Column

Hello All,When i query a database I receive certain as follows:ID       Data1        Data0 [2], Data1  [2602], Data2 [130], Data3 [64], Data4 [550], Data5 [1070], Data6 [1117]2 &nb

View Article

Advice on creating unique clustered index

I've been studying the possibility of indexing a particular view that takes 26 minutes to run, trying to optimize it.  I'm experimenting with a test version of the view.  After reading a lot of...

View Article


Not sure how to get all data on one line

Hello everyone,I'm still getting my feet wet in SQL but I'm not sure how to proceed to correct this query:[code language="sql"]SELECTDISTI

View Article


How to create data with numeric ranges

I have been requested to create a report using numeric ranges.  So for example, a user should be able to put in a starting number (100) and an ending number (200) and an interval (5). What would I...

View Article

Are my nested IF/ELSE statements inefficient? Is there an alternative or...

HelloI am writing a stored procedure which will be called from a website (.aspx, c#) to update the stock quantity based on the ProductID of the item. The stored procedure needs to perform various...

View Article

[Best Practice] VARCHAR >> INT and Truncation

So, i'm currently using the below to change a VARCHAR field over to a INT and remove the first character (contains a £).The goal; enable maths on the field. I realise long term i will want to change...

View Article

How to change column padding for existing table?

We need to change padding (it is reflected in is_ansi_padding from sys.columns) for a column in existing table. We don't want to drop/create table.Thanks

View Article


Help needed removing part of email message

We have a sql based erp that sends an email message after certain procedures (such as order acknowledgement, etc.)The email message consists of Subject, email body(entered by user if needed) and email...

View Article

Dynamic Statement with Cursor loop, help

Hi ,I am trying to build a dynamic query which will create a select. I am trying to use a cursor, cause I don't know in advance how many fields I will get from the cursor loop.I am currently trying...

View Article


Performance issue with EXCEPT

I am rewriting some user-defined functions and I want to test if they give the exact same result as the functions they are replacing. I am testing the functions on all corporations of my database and...

View Article

how to select several columns with one being distinct

As you can see in the screenshot below (I hope it is legible) I have a basic query. I need it to return the columns selected, but only one row per "componentId". Writing it out as SELECT DISTINCT does...

View Article


“LOGIN FAILED FOR USER ‘NT AUTHORITY\ANONYMOUS LOGON’” WHEN YOU RUN AN SSIS...

i researched my issue and found the below link. I don't want to use a sql job. I'd rather now hard code the sql login the in the proc either. Does anyone know if this issue has been addressed by...

View Article

Quicker Way to Get Accurate Row Count

We are currently using SQL Server 2014 (enterprise) for our source system and data warehouse.  Our ETL has a row count validation that runs at the end of each ETL execution.  It ties out the number of...

View Article

Need to create four columns to existing query output based on if condition

Hi all,I have a stored procedure and I need to include new columns in it based on the if conditions. Please check my stored procedure in SQL server:select PJ_RetStore_Sal

View Article
Browsing all 3145 articles
Browse latest View live