Questions tagged [sql-server-2012]

Use this tag for questions specific to the 2012 version of Microsoft's SQL Server.

Filter by
Sorted by
Tagged with
-2 votes
1 answer
33 views

How to read XML in SQL Server [closed]

<Result xmlns="uri:SomeNamespace"> <PD:Summary xmlns:PD="https://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelDescription"> <p1:p ...
user8541632's user avatar
0 votes
0 answers
18 views

Oracle Instant Client installed not in SSMS provider list WS2012

I simply would like to connect to an Oracle database from SQL Server. WS version: 2012 SQL Server version: 2012 (v11.0.7507) I'm having difficulties in properly installing the Oracle Instant Client ...
KnockOutMan2015's user avatar
1 vote
1 answer
120 views

Query takes 10 minutes when table variables are used versus 2 seconds when temporary table is used

There is an old query written by someone which uses table variables and it was running in 2-3 minutes. From last 2 weeks, it runs eternally even though the dataset size is approximately same. Hence, I ...
Madhukar's user avatar
  • 1,165
-1 votes
1 answer
29 views

Reallocate duplicate record references and remove redundant records

I have duplicated data in Table 1. All information in the fields listed below must be identical to be considered a duplicate. The table has other columns but these are inconsequential. The unique ...
MG SQL Muppet's user avatar
-1 votes
0 answers
14 views

How to backup the mssql server database from VPS and upload it to another online server

How to backup the ms SQL server database from VPS and upload it to another online server like go-daddy automatically at particular time and day. I have create a Job for Backup and give the go-daddy ...
Ankita Sen's user avatar
1 vote
1 answer
67 views

Associate data in a table from several crossed tables

I am using SQL Server 2012. We have Orders from several companies. Each Order can have one or more Sales Order Line. And the Order Line can have one Article, but it never has more than one Article. ...
graphene's user avatar
  • 121
0 votes
2 answers
149 views

Find top 1 record from join table for unique id by timestamp

I have three tables, item, unique_item_code and unique_hist. item table has mapping relation with unique_item_code table and unique_item_code has mapping relation with unique_hist table. Every item ...
Rahul's user avatar
  • 121
-1 votes
0 answers
29 views

How to Connect Python with Microsoft SQL Server 2012 on CentOS 5.9 OS? [closed]

I have centOS 5.9 installed in virtualBox, and it has default python 2.4.3 version. I want to connect MS SQL Server 2012 with it using python script. There are multiple option I can use of pyodbc, ...
kush patel's user avatar
0 votes
0 answers
11 views

Column header with @query_no_truncate parameter

I am trying to email a csv using sp_send_dbmail but one of the column values are truncating at 255 characters. So I used the @query_no_truncate parameter to display the full column value in the csv ...
Alexandre Alvaro's user avatar
0 votes
0 answers
86 views

The incoming request has too many parameters. The server supports a maximum of 2100 parameters. Reduce the number of parameters and resend the request

Team , I'm facing a strange issue in my project. let me explain the tech ladder that I'm using JDBC Version : 7.4.1.jre11 MSSQL Version : Microsoft SQL Server 2016 (SP3-GDR) (KB5021129) - 13.0.6430.49 ...
aruntheimperfect's user avatar
-4 votes
2 answers
82 views

How to join 2 tables (Table 2 data if present in Table 1, that specific record must not be selected) in SQL Server

I have 2 tables, Table1 and Table2. Both tables have only 1 column value. Table1 - er3, 5ty, 5y6, 72j, 98e, sf1, 3mn, 9w2 Table2 - r5k, ad8, 5ty, sf1, 34x How can we query, so that we can get the ...
Earth's user avatar
  • 3,507
0 votes
1 answer
74 views

How can I use SQL and Python together to fill a template file with SQL data?

I have a text file that is a template like this: Question: {QuestionStem} {answers} Correct answer: {correctAnswer} Date: {examDate} Class: {examClass} I need to populate it and save a copy of it ...
SkyeBoniwell's user avatar
  • 6,367
0 votes
1 answer
50 views

Allocate contracts equally across people?

I have 2 tables like the below in SQL server.. ContractID StartDate ContractManagerID 222 01 jan 2023 NULL 223 02 jan 2023 NULL 225 02 jan ...
Jess8766's user avatar
  • 377
-1 votes
2 answers
30 views

Select rows only if having row number partition count equals to specific value

I have a temporary table (from Stored Procedure) named TEMP1 as follows: Rnk (Row Number Partition by DocNo) DocNo TransDate 1 Doc1 1 Aug 2023 2 Doc1 2 Aug 2023 3 Doc1 3 Aug 2023 1 Doc2 4 Aug ...
Yoseph's user avatar
  • 3
0 votes
0 answers
22 views

Using CHARINDEX positions to determine data to parse

I am trying to parse data from a table that was loaded from an old database migration, where the data is one long string of data. It starts and ends with certain parameters and based on those ...
Sotark's user avatar
  • 186
1 vote
0 answers
34 views

Why when using SUM(field) the total is duplicated for different items?

I have a query that needs the total parts sold. But because of the name of the part, it doubles the line. How could I solve this problem of doubling the amount? PS. vendorNum = model code within the ...
Farley A Souza's user avatar
-1 votes
1 answer
35 views

SQL join a table with an indirect foreign key

I am trying to select 2 columns from 3 tables that are indirectly linked dbo.Person BusinessID Name 001 Haley Keller 002 Ceila Mark EmployeeDepartmentHistory BusinessID DeptID 001 201 002 104 ...
S. Chilaka's user avatar
-4 votes
2 answers
54 views

SQL Server related time range issues

I have an hour-by-hour database for N years. I want to extract a period of time in each year. For example, 2-3 21:00:00 to 5-12 09:00:00. I want to query all the data in this time period for all the ...
Lix's user avatar
  • 13
0 votes
4 answers
52 views

How do I select a specific date OR the latest date if the specific date doesn't exist?

I have a table of employee assignment START_DATEs and STOP_DATEs. Employees only have one assignment at a time, so after one assignment stops another begins eventually. Assignments that are still in ...
dhwu's user avatar
  • 17
0 votes
1 answer
24 views

Get product and customer name for products not purchased

Below, are my 3 tables:- declare @customer table(CId int identity,Cname varchar(10)) insert into @customer values('A'),('B') --select * from @customer declare @Product table(PId int ...
Rahul Aggarwal's user avatar
0 votes
0 answers
15 views

SSRS Report Builder 15 pass parameter to subquery from count

Hi I have built an SSRS Report with the following expression =SUM(IIF(Fields!OurSplitYear.Value = Fields!TodaysSplitYear.Value AND Fields!NextDueDate.Value > Today(),1,0)) that basically counts if ...
Deb's user avatar
  • 11
0 votes
0 answers
22 views

Update Inner text value of XML node with variable [duplicate]

I am having the following XML <Lists xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <List ListName="Rules"...
AMDI's user avatar
  • 915
0 votes
0 answers
19 views

How to batch re-deliver SSRS Subscriptions for past days in SQL Server 2012?

Our old report server began having issues and we didn't have any redundancy. This server had been set up long before I began working at the company. I set up a new SQL Server instance with SQL Server ...
Trevor's user avatar
  • 481
-1 votes
1 answer
47 views

How can I do an insert for two tables at the same time using SCOPE_IDENTITY()?

I have 2 tables that I need to populate with 100 rows from a remote linked database. The first table is easy, because I can just do a simple INSERT from a SELECT. However, I also need to populate a ...
SkyeBoniwell's user avatar
  • 6,367
0 votes
0 answers
54 views

How do I check if these warnings while using SQL Server Import and Export WIzard will cause me any issues?

I was importing data from one SQL Server to another and I got a few of these errors. Setting Source Connection (Warning) Messages Warning 0x8020400d: Source 3 - blank [370]: The Source 3 - blank....
zjn's user avatar
  • 7
-2 votes
1 answer
40 views

How can I remove duplicates from a query result if I know the table and column that is causing the duplicates? [duplicate]

I have a huge query with a lot of JOINs. It is producing duplicates. I am using this technique below that I found here on SO to identify which table the duplicates come from: SELECT TableA = '------...
SkyeBoniwell's user avatar
  • 6,367
0 votes
1 answer
27 views

SQL CASE statement in the WHERE clause

I have a report for a user and the dataset has 3 possible dates they can evaluate. (although this can grow to 5 that we have in our system). For each of those three dates they can pick a start date ...
Elizabeth's user avatar
  • 719
0 votes
1 answer
36 views

Select everything that comes after a newline

I would like to select in a field everything that comes after the line break. Example in: "Number of implants Number of SC implants" keep only "Number of SC implants" Knowing that ...
Papa Yatma Diop's user avatar
0 votes
1 answer
43 views

Use MSQL Server CTE to return all Parents

I have the below table: CREATE TABLE [dbo].[Areas]( [AreaID] [bigint], [ParentArea] [bigint] NULL, CONSTRAINT [PK_Areas] PRIMARY KEY CLUSTERED INSERT ...
umencho's user avatar
0 votes
0 answers
19 views

Work around on Sum(case when sum(x)>y) included in a Group by

Here is a similar Table I am working with: Username Id Columnx Value person 00201 x 20022 person 00201 x 2222 person3 00203 x 2211 Here is the result I want to get to: Username Id Test person ...
SmashingSucess's user avatar
0 votes
0 answers
82 views

'Invoke-Webrequest' works fine on prompt but fails when executed through

I am reading latest code from github to update the procs. It works well when I execute from powershell. But it fails when I do from SQL Server Agent Job. This is the format of my code cd "C:\...
preethi's user avatar
0 votes
0 answers
28 views

SQL SERVER Update table from tables with increment on some fields based on max

Table 1 -- Where information will be finally stored Table 2 -- Updated information from Access Table 1 : ProJ# LOC_ID OBJ_ID OBJ_U_ID OBJ_TYPE OBJ_# OBJ_V A 1 1 1 A 1 1 A 1 4 4 A 3 null A 1 5 5 A ...
Matthew Throesch's user avatar
0 votes
2 answers
38 views

Pivoting the table rows to colums

My table is as follows: declare @tab TABLE (Id int, Rid INT, FValue VARCHAR(50), FText VARCHAR(50)) INSERT INTO @tab VALUES (1,1,'Patient','P1'), (1,1,'Sdate','01/06/2023'), (1,1,'Acc#','...
Rahul Aggarwal's user avatar
0 votes
0 answers
29 views

How we can get nvarchar column value from SQL Server in talend

I'm trying to get nvarchar value in Talend from SQL Server but am not able to get it. Attached is the snapshot for these enter image description here enter image description here In SQL Server I have ...
Himamshu's user avatar
0 votes
1 answer
22 views

How can we use CTE to handle cumulative date?

I want to write a recursive common table expression (CTE) in postgres to calculate a cumulative date, is it possible and how? Many thanks. Here's an example : | Item | Recorded Date | ...
john chan's user avatar
  • 213
-1 votes
1 answer
47 views

Best way in SQL to store Name of Column along with the value of a particular row dynamically within a Stored Procedure in MS SQL Server? [duplicate]

I want to retrieve the name and value of each column in a SQL table for a particular record, and store them as a separate entry in a different table using a stored procedure. I have tried using an ...
Yash Dhanwantri's user avatar
0 votes
6 answers
96 views

Update row in the same table

I have Table 1 that look something like this EID Hold Source 3232 KLME jame.k@gmail.com KLME https://google.com EEME david.e@gmail.com ...
aasenomad's user avatar
  • 395
1 vote
2 answers
86 views

percentile_cont with aggregate Function

I'm using SQL Server 2012 and trying to calculate some aggregate functions and percentiles on a data set with two columns (id and time). In my research I found some solutions, but they don't work for ...
likethemike90's user avatar
2 votes
1 answer
184 views

com.microsoft.sqlserver.jdbc.sqlserverexception: the stream is closed

I am using mssql-jdbc-12.2.0.jre8.jar and HikariCP-4.0.3.jar to connect to Microsof SQL Server Database SQL Server version is: Microsoft SQL Server 2012 - 11.0.5548.0 (X64) Sep 6 2014 17:19:28 ...
Mahmoud Saleh's user avatar
0 votes
1 answer
41 views

How to retrieve an image from database and show it in asp image box with a click of a button?

private void ProcessedImage() { try { if (FileUpload1.HasFile) { int length = 192; int width = 192; using (...
KARTHIK LAGVANKAR's user avatar
0 votes
1 answer
163 views

Cannot connect to the Azure SQL Server using ad admin account

I have created an Azure SQL Server and assigned an ad administrator to it using terraform resource "azurerm_mssql_server" "server" { name = "adauth-...
Tauqir's user avatar
  • 389
1 vote
1 answer
52 views

user cancellation not being caught by TRY CATCH

I'm having trouble in MSSMS 2012, my SQL SCRIPT may be cancelled by the user, I've made a TRY CATCH block to log into a table any error event (including user cancellation) but user cancellations are ...
RindoquesUwU's user avatar
0 votes
0 answers
43 views

SqlServer >> View syncronization status

I have two sql servers with repl-merge replication, on the subscriber server in Local Subscription if I tried to view Syncronization status I got windows with last status message "The specific ...
Samir Ibrahim's user avatar
-1 votes
2 answers
73 views

SQL Vlookup Value in Same Table to Get Value From Another Table

I have a table (gbfol_det) that contains three columns and a second table (argcloy_h) that contains one column. I need to do similar to an Excel VLOOKUP. I want to check for posting_code = 'gcs' and ...
WolfieeifloW's user avatar
1 vote
2 answers
40 views

Formation of 20 Character string concatenating by five fields [duplicate]

i want to Form a String of length 20 character with preceding zero as per rule as given below. my table looks like:- The maximum number of 0 preceed in these five field are for CLASS: 4 VENDOR : 5 ...
Rosalina Matheew's user avatar
0 votes
0 answers
39 views

Using Join but the value was multiples

I have 2 tables like this. Table A has blank value in statusID 202 StatusID CallID ContactID 202 65490 302 1029-2134 65490 Table B DateTime SessionID ContactID 2023-05-15 02:29 0341-3124 65490 ...
Yan Aditiya's user avatar
-1 votes
1 answer
42 views

Is there a way to transform my query into a way that my client needs?

I have the following table structure: candidateExamGrades ------------------- courseID examID examName candidateID examGrade candidateCourseGrades ---------------------- courseID candidateID ...
SkyeBoniwell's user avatar
  • 6,367
-1 votes
1 answer
84 views

How to execute temporary tables stored procedure in SSIS Packages in result sets

I am working on a SSIS package in which we need to execute a stored procedure in OLE DB Source and destination of stored procedure data is Excel. The problem is that the stored procedure contains ...
Talha Malik's user avatar
0 votes
2 answers
66 views

Dense rank for counting distinct items using case expression

I have a table that looks similar to the one given below: comp_id Item_id Priority 123456 123 1 123456 321 1 123456 333 2 123456 ...
roller's user avatar
  • 47
1 vote
1 answer
120 views

pyodbc insert decimal Error converting data type nvarchar to float

Can't understand, which problem can cause this: Error converting data type nvarchar to float. I'm getting data by api from one software and would like to insert this data in sql database. here are the ...
Elina's user avatar
  • 23

1
2 3 4 5
342