Questions tagged [sql-server-2014]

Use this tag for questions specific to the 2014 version of Microsoft's SQL Server database engine. SQL Server 2014 is the predecessor of the later SQL Server 2016.

0
votes
0answers
13 views

Acces denied when remotely acess a SQL Server database

Hi I am remotely trying connect SQL Server database from a computer with a third party app. The computer is using SQL Server 2014 Management Studio. The app say the host has been found, but the access ...
0
votes
0answers
29 views

Double click .sql file open another SQL Server Management Studio window

I already have a SQL Server Management Studio window opened and running. Previously when I double clicked on .sql file, it would open in SQL Server Management Studio. Now that I change to another ...
1
vote
1answer
16 views

Hierarchical structure for concrete id

I have a recursive database table and hierarchical view through all table data CREATE VIEW dbo.vw_hierarchicalView AS WITH hView (Id, IdParent, Level) ...
2
votes
1answer
25 views

Building SSIS 2014 Project deployment model from cmd line

Build SSIS 2014 Solution/project from cmd line is not working Used several scripts with no luck. C:\Users\Source\Repos\ETL "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\...
-1
votes
1answer
25 views

“Incorrect syntax near 'WHERE'” in Delete queries

For about the past year I having an issue with having my delete queries recognize a where clause. I am not talking about big major complex queries. Even little simple queries. Usually I am in a hurry ...
1
vote
3answers
50 views

Split single column into multiple columns in SQL server based on number of records

I have around 28 records (which is dynamic, that is sometimes odd numbers of records and sometime even) in a single column. Would like to split those into multiple columns based on a variable. There ...
-1
votes
1answer
32 views

Query have different (no) result when using parameters

I have a strange problem. When I run the following query against my Sql Server 2014 database the result is as expected (note that LogDay is DATE not DATETIME): SELECT * FROM myView WHERE LogDay ...
-3
votes
0answers
22 views

mapping to venues sequentially by id one by one [closed]

i want fill the venues at time allocating one BY one TO venue sequentially --create table a(venuecode varchar(255),capacity varchar(100)) --create table b (id int identity(1,1),otprid varchar(255))...
1
vote
2answers
75 views
+50

How to use INSERT INTO OPENROWSET to export to Excel without being an admin on the target server

I am trying to grant a user access to export data from SQL Server into an Excel file using OPENROWSET. The user is getting the following error: Cannot initialize the data source object of OLE DB ...
1
vote
1answer
54 views

Sum based on field behavior using a loop or dynamic query

I have a table like this: ID FullName ID_Total Balance 100000 kkkk 100020|100003|100080|100050 NULL 100001 llll 100080|100050|100005 ...
0
votes
0answers
13 views

MSLSQL Server database gone corrupt its metadata

I restored my mssql database from 2008 to 2014, after that when i try to execute DELETE/UPDATE query, it corrupts its meta data/system tables. After that tables hides and show the following error if i ...
0
votes
0answers
18 views

How to write an append/replace stored procedure/function? [duplicate]

I have a master table stored in my SQL database that contains all historical ticket data for incoming queries. I am pulling new data through an API, converting JSON to a crosstab format and changing ...
2
votes
1answer
21 views

Remote delete inconsistently hits resource limit / timeout

My SQL Agent job runs every morning at 4 AM. It has 10 steps. The last few weeks, it has been failing a couple times a week on Step 3 with this error. The OLE DB provider "SQLNCLI11" for linked ...
0
votes
3answers
19 views

Difference in behavior with convert 108 and format while using Datediff

I am trying to extract HH:MM:SS part from a datetime field and using it to get the date difference in minutes between the extracted parts. However I am getting different behavior with conver (108) ...
0
votes
2answers
51 views

Trying to understanding what a SCALAR FUNCTION does

I have been tasked with documenting the stored procedures and functions in our database and i have come across one which i am not sure what it is actually doing. From looking at and googling parts ...
0
votes
0answers
15 views

Manage auto shrink

I have a db that I do not manage directly. A vendor set it up and manages it but, I am the poor engineer who cleans up the mess occasionally... The db is set to simple recovery. auto-grow and auto-...
1
vote
3answers
40 views

Select minimum Seq Num by ID

Just trying to write a simple query to get the row (per VENDOR_ID) with the minimum CNTCT_SEQ_NUM where the CONTACT_NAME is not blank. Here is what I have written: SELECT VENDOR_ID, MIN(...
2
votes
2answers
49 views

Wildcard with SQL Replace function?

I have a variable with value as below DECLARE @var VARCHAR(MAX) = 'ROOT(10) AS TEN, ROOT(50) AS FIFTY, ROOT(70) AS SEVENTY' I would like to get only 'TEN,FIFTY,SEVENTY' from the variable Below is ...
1
vote
1answer
39 views

Can you set collation of T-SQL Variable?

I've searched high and low but can't find an answer, can you set the collation of a variable? According to the MS documentation, it seems that it's only possible on SQL Azure: -- Syntax for Azure ...
0
votes
0answers
39 views

UTF-8 encoding for .sql files created or modified in SSMS

The default encoding for files saved by my SSMS (v18) is ASCII, not UTF-8. I’ve tried the steps below to set the default encoding to UTF-8 (so that I wouldn’t have to remember to set it every time I ...
0
votes
0answers
51 views

Cannot open database resquested by the login

I have created a WCF Service in Visual Studio 2017. I am trying to create a connection of my service with SQL Server Management Studio 2014. I am getting the following error. Cannot open database "...
0
votes
0answers
27 views

Break string in sql query at certain length and and at certain character

I have created 2 columns datatype string,int (company,acc_id) in a ctc table which has multiple comma separated values. I need to break these string at 255 character and at comma separated character ...
0
votes
1answer
25 views

How to Join tables in SQL with SUM Function and Group?

I'm creating a report to display project wise cost and revenue. I need to group sum of A/P invoices and Sum of A/R invoices according to the project. Same project could have many A/P invoices and A/...
0
votes
0answers
46 views

How to extract numeric characters from character values and delete character values

I want to extract only the numeric values from the character value in SQL Server. Details of the data as follows. like +/- 0.6 inlbs(Want to take only 0.6) 38.00 to 42.00(Want to take only 42.00) ....
0
votes
1answer
47 views

How to add “or” in SQL select query?

I am creating a report to get customer wise incoming payment in a particular period. Payment can be received through Cheques, Direct Bank Transfers, Cash. This payments saved in the database in a ...
1
vote
1answer
26 views

Connection error in Subscription between my SQL Server and Azure database

I'm having a lot of trouble with doing a replication between a SQL Server 2014 and Azure. I use a remote desktop to connect to the SQL Server machine and there, I start doing all the replication ...
0
votes
1answer
44 views

Creating one record for a continuous sequnce of dates to a new table

We have a table in Microsoft SQL Server 2014 as shown below which has Id, LogId, AccountId, StateCode, Number and LastSentDate column. Our goal was to move the data to a new table. When we move it ...
0
votes
0answers
27 views

Run multiple SQL statements concurrently within a single session in SQL Server?

I have written a stored procedure which makes use of two temporary tables and in the final select statement the computed temp tables will be used. Below is the structure of my sproc :- -- ...
0
votes
3answers
50 views

SQL data query - displaying count correctly

I have an SQL database that has log data of machines and users that use a piece of software. i need to create a query that i can display all connections on a certain day (today) and group them by ...
1
vote
2answers
56 views

Splitting a VARCHAR column into multiple columns

I am struggling to split the data in the column into multiple columns. I have data of names of customers and the data needs cleaning as there can be duplicates and I also need to set up new standards ...
0
votes
2answers
68 views

how to split words before and after colon in separate columns to rows in sql

I have a column [LongText] in a table and its row value is merging of all Attributes and their values. Below is the example. Can we split colon before and after words into two columns as shown in ...
0
votes
2answers
48 views

How can I achieve row level security in SQL Server 2014

Is there any way to get row-level security in SQL Server 2014? My problem is: I have a table with data for multiple regions I created a view for each region Specific user will have access to ...
0
votes
1answer
53 views

How to execute single sql query in multiple databases

I have cloud server where I've hosted a web application for my customers. Each customer has a different SQL database and website in IIS. Whenever I want to execute a sql query to update something, I ...
1
vote
1answer
35 views

Update Multiple rows with all diffrent values

I have a spread sheet with all the User ID's and their updated address's, I have over 10K user accounts that I need to update with their new addresses, I cant write a script for all the 10K Users, how ...
0
votes
0answers
26 views

how to make SQL server accept [local] as server name? [duplicate]

I'm trying to login to MS SQL SERVER with the "." instead of server name, it gives an error. is there a way around that ? i compared between my instance and an instance on a friend's laptop, his ...
0
votes
1answer
26 views

Is there any method to make computeds columns have 2 parameters as range?

I'm trying to create a procedure where, declared the variables initialized and having created a computed column, the average value has the variables @ efinal1 and @ efinal2 as ranges create proc ...
1
vote
2answers
62 views

converting rows to column for a set of ids

Consider the following query: DECLARE @t1 TABLE( CompanyId INT, DirectorName VARCHAR(100)); INSERT INTO @t1 VALUES (1,'D11'), (1,'D12'), (1,'D13'), (1,'D14'), ...
0
votes
2answers
40 views

How to I get latest record only based on the invcreated

How do I get the latest record only based on the invcreated? there are more than 1lak records and same jobno having more than 100 records. In an example, I am taken only one jobno JobOrderID ...
1
vote
3answers
36 views

How to Select the first time entry, then only times greater than 5 minutes apart

CREATE TABLE import_time ( date datetime NUll, time datetime Null, Employeeid nvarchar(25) Null) INSERT INTO import_time (date, time, Employeeid) Values ('2019-05-22 00:00:00.000', '...
0
votes
4answers
74 views

collapse rows using sql stuff function

i have three tables in my sql database and i am trying to collapse rows in sql server using stuff function from 3 tables i had try inner join and left outer to do so but didn't get result as expected ...
0
votes
0answers
25 views

How to fix “Windowed functions can only appear in the SELECT or ORDER BY clauses.”

Getting the below error message when queried Windowed functions can only appear in the SELECT or ORDER BY clauses. SELECT A.FULLNAME,A.RLOTEAM,A.rloFunction,A.tfalUserID ,IIF(dd.datekey ...
0
votes
0answers
40 views

NOLOCK Hint with varchar(max)

We have to use WITH (NOLOCK) due to few performance issues allowing dirty read. A few of the tables have columns with a Text datatype, and we started getting this error some times: A read ...
10
votes
2answers
119 views

The SQL Server Network Interface library could not deregister the Service Principal Name (SPN)

I've set up a SQL Server service account with permissions to read and write service principal names. When SQL Server starts up I get the expected message in the logs showing that the service account ...
0
votes
2answers
28 views

Too much Data using DISTINCT MAX

I want to see the last activity each individual handset and the user that used that handset. I have a table UserSessions that stores the last activity of a particular user as well as what handset they ...
0
votes
1answer
22 views

How to avoid parallel execution within a stored procedure

I have a stored procedure that should processes data for a certain day and fill a history table. But if the data for that day has already been processed, i.e. if there is any single row for that ...
0
votes
1answer
34 views

How to add year parameter to SQL query?

I'm creating a report to compare sales of two years using crystal reports.I need to add Year parameter to filter the data by entering to years to CurrentYear Parameter and PreviousYear Parameter.How ...
1
vote
3answers
45 views

How add aggregate function value in where clause?

I need to get sales comparison between two reporting periods. It should display sales which only have decreased than previous year. I tried below query to get values.But how can I add aggregate ...
0
votes
0answers
17 views

Concurrency of update statistics

Statistics on memory optimized tables are created at the time of table creation and never updated. That means that all statistics are created on empty table. In order to update index statistics on ...
0
votes
3answers
47 views

How to insert new rows based on values in other columns in sql server?

I have a dataset like below: Id A14_Comment A15_Comment A16_Comment 1 Comment1 null null 2 Comment2 Comment3 Comment4 3 null Comment5 ...
0
votes
1answer
34 views

Create table script shortcut in SQL Server

Just like generating a script for a stored procedure using sp_helptext, do we have any short cut to generate the script for a table? I am aware that we can right click on a table and generate a ...