Questions tagged [sql-server]

Microsoft SQL Server is a relational database management system (RDBMS). Use this tag for all SQL Server editions including Compact, Express, Azure, Fast-track, APS (formerly PDW) and Azure SQL DW. Do not use this tag for other types of DBMS (MySQL, PostgreSQL, Oracle, etc.). Do not use this tag for issues on software and mobile development, unless it is directly related to the database.

Filter by
Sorted by
Tagged with
0
votes
0answers
10 views

Insert query works through SSMS but SqlCommand code gets error “Insufficient result space to convert uniqueidentifier value to char.”

Table for the inserts: CREATE TABLE [dbo].[CcureMessage]( [CcureMessageId] [uniqueidentifier] NOT NULL, [Event] [varchar](20) NULL, [Type] [varchar](20) NULL, [Message] [varchar](max) NOT NULL, [Xml] ...
0
votes
0answers
11 views

PHP SQL show data in group based on id order by time

I have a table which contain act_id (primary key), trip_id, start_time, end_time and activity name. I manage to show rows of data order by end time using while loop. However, I like to group the data ...
0
votes
0answers
10 views

Report showing column name where should be showing value of the field in SSRS

I am currently developing a report using SSRS. I have a column called 'FROM' and it is INT data type. I am setting the field correctly but somehow it shows 'from' in the report. I set up the ...
0
votes
0answers
17 views

Query to view the date and time a row was last updated for table without having an existing trigger\mechanism?

I'm sure this is going to be a hard no, but I have a table that I need to know the last update date and time for one particular row, written in the past. Is there a way to find this information? ...
0
votes
1answer
9 views

How to backup SQL Express 2019 and upload to Azure Blob with 120 days retention

How to backup SQL Express 2019 and upload it to Azure Blob with days retention?
0
votes
0answers
12 views

SQL Server Docker Compose SQLCMD does not execute

I'm currently trying to set up a SQL Server in docker compose and I want to create the database on build with the RUN instruction. This doesn't work, however when I execute the same command on the ...
0
votes
0answers
8 views

Reporting Server Idle Connection Timeouts

I'm using SQL Server 2017 and idle connections are timing out after 20 minutes. Where do I change this so they don't time out at all?
-1
votes
0answers
34 views

Write a UNION to always return a result set?

I have a query that returns an OrgID, Total Annual Wage, and Wage Effective Date from the Actual_Pay_Hours table. Additionally, there is another table called Combo_Table_Detail which contains Wage ...
0
votes
0answers
11 views

How do I upload .SHP file to SQL server?

I have .shp files that I want to upload to SQL Server and then combine with data and use in Tableau. I am trying to find an easy solution to uploading .shp file to SQL Server (2017). I tried OGR2OGR ...
0
votes
2answers
27 views

Insert/merge multiple records into a single one using a variable table to print on postcard both sides

I have a task of printing a set of addresses on a postcard on both sides. On the front the owner address will print centered, and on the back the parcel number, address, along with other data. Four ...
-1
votes
3answers
47 views

Display only records which are not duplicated

I wish to display only records which have no duplicate. CREATE TABLE #TempTbl1 ( Circuit varchar(55), Bandwidth decimal(7,1), Unit bit, CurrentID int, ); INSERT INTO #TempTbl1 VALUES ...
0
votes
1answer
28 views

Query to “PIVOT” the results of SalesAmount & CumulativeMonthly for ALL YEARS

I have a database table that captures every Sales Transaction: Transactions ( ID INT, TransactionDate DATETIME, SalesAmount MONEY ) I need to run a T-SQL query to product a Sales ...
0
votes
1answer
64 views

Why is “IS NOT NULL” in SQL Server still returning NULL values?

I am trying to exclude NULL values from my result. However"IS NOT NULL" seems to be not working. I attempted below and included screen shots of my sql code as well as the output in a speadsheet. The ...
-4
votes
0answers
42 views

Does unique or index property creates a non-clustered index?

We have a table for users with the columns below: (Primary Key) user-id (Index) username password (Unique Constraint) email (Unique Constraint) phone_number I already know that a primary key ...
0
votes
1answer
19 views

High CPU usage (300%) when inserting data with knex

I want to insert large amounts of data to SQL Server via knex. I've lowered the number of inserts at once and concurrency of inserts but I still end up with high CPU usage. Could it have something ...
0
votes
2answers
33 views

Send email via SQL Server Agent, based on the result of a T-SQL stored procedure

I have a T-SQL stored procedure (which returns a single scalar value called @HourDifference as an output parameter); you can see the execution below: DECLARE @HourDifference_output TINYINT; -- I ...
0
votes
1answer
51 views

SQL Server - Function, performance issue

Let's consider a simple query: select distinct p.id from posts p inner join Users u on u.id = p.owneruserid inner join votes v on v.UserId = u.Id inner join Badges b on b.UserId = u.Id where ...
0
votes
1answer
21 views

Linked Server unable to begin a distributed transaction - SQL Server

I am end user on SQL Server 2016 (SP2-CU7-GDR). I am trying to execute a query of the following nature: DECLARE @sqlcode VARCHAR(MAX) SET @sqlcode = 'proprietary sql code' TRUNCATE TABLE [...
0
votes
1answer
19 views

SQL Convert Binary Hex representation to string keeping same output

I have the following SQL Server query DECLARE @StartRange BINARY(8) DECLARE @EndRange BINARY(8) SET @StartRange = 0x0000004A50F119B SET @EndRange = 0x00000004A50F11FF SELECT CONVERT(BINARY(6),...
0
votes
3answers
38 views

T-SQL query to summarize sales for ALL YEARS: with total per month per year, and cumulative monthly amounts

I need to create a Sales Report that shows all years sales per month, and cumulative sales. The database table is simple: Transactions ( ID INT, TransactionDate DATETIME, ...
0
votes
2answers
30 views

Dynamically select table names from VS Data tool

I have a SSIS package that syncs data from source to destination Tables. However I am looking for a solution where whenever the package runs it automatically selects table from previous month i.e. (...
0
votes
2answers
22 views

Entity Framework Core 3 - can't get query to work

I am trying to construct a query using EF Core 3.1 across multiple tables, and it's simply not working. I'll try to explain with some dummy examples. Assume my SQL tables all have the following ...
0
votes
2answers
40 views

Filter with GROUP BY and CASE pr IF or IF EXIST

1.0. I have a table like this: COD CICLE SCORE DATE 020003931 XVIII 16 Dieciseis 13/03/08 020003931 VIII 17 Decisiete 13/03/08 020003931 II 18 ...
0
votes
1answer
23 views

Translate a SQL CASE Statement into LINQ

I am looking for assistance translating a SQL CASE Statement into LINQ code. Thing is, I need to implement it into code that already exists. Basically, I need to transform memberIssues.IsClosed into ...
0
votes
0answers
21 views

Run a SQL query after hibernate is initialized and before it creates/updates tables

I am using Spring boot with hibernate to create schema and tables. Right now I have only one table (with data) in the schema. I have to add one more table and relate to the existing table. As there is ...
0
votes
1answer
34 views

SQL Server - Database Connection Limit

We're having an issue with SQL server where the number of database connections hits its limit (100 is the default) and causes the website to not respond to further requests until an application pool ...
-2
votes
1answer
25 views

Query taking more than 15 min to execute

I have a query which is something like below: select distinct ** from (select distinct column 1, column 2 ....column n from (select distinct column 1, column 2 ....column n from ...
0
votes
1answer
39 views

Join where one of the returned values is in a database named by an element returned from the join?

I want to do a join of multiple tables. In one of the tables is the name of a database and I want a value from a table in that database to be returned as an element of the join. No idea how to do it, ...
0
votes
0answers
24 views

What ASP .NET connection pool managers are available [closed]

We are scaling our back ends (the server code) and running into an issue with the ASP.Net database connection pool management. The issue is each back end is creating its own connection pool per client ...
1
vote
0answers
53 views

SQL HashBytes vs .Net HashAlgorithm

I am working on integrating a new Authentication rest API that our web dev team wrote. The last piece I need to get working will return a User's User_Id GUID when given a username and password hash ...
0
votes
3answers
46 views

Is this a valid top expression in SQL Server 2005

I am reviewing an old code base and I have come across this SQL statement: SELECT TOP 1 3 As 'StatusCode' FROM something a JOIN other bs on --etc. My SQL is a bit rusty and is this ...
0
votes
0answers
31 views

How does SQL Server convert sub queries to joins? [closed]

For very complex queries, involving many nested subqueries, SQL Server's query optimiser manages to convert subqueries into a more flat, relational-algebraesque structure. What is the algorithm that ...
-2
votes
1answer
27 views

Two Column Data Select SQL Server Vb.net [closed]

Hello friend i need help i have two column (Brand Model) i need when i find the data from my table through text boxes then show this data already available in the following row Dim cmd As New ...
0
votes
1answer
28 views

Create a column which references other columns and their values?

I am trying to create a time series which shows what the values of a specific Column was at a particular time. All I currently have access to is a table which logs all the changes, the current value ...
0
votes
2answers
39 views

How to update a field in a column on MS SQL after making sure other fields are the same

Table is here for more clarity: What I am trying to do is: - Look for every single entry in [PayupName] that has the word 'Nominal', and then, deduct the [payup(bcp)] value of that entry from the ...
0
votes
4answers
49 views

How do I use an IN Clause in Sql Server Parameter

Can someone help me please, I am trying to use an IN clause in a parameter in SQL server 2018. I would then use the parameter in the Where clause within the select statement This is the query below: ...
0
votes
1answer
21 views

Exporting from SQL Server to Postgres ERROR: column is of type boolean but expression is of type integer

I am using SSMS to export a table into my Postgres DB as described here. Everything is going great, the table and columns are created in Postgres, but when the data is to be loaded it errors out with ...
0
votes
2answers
18 views

SQL CASE expression not selecting largest value across 3 columns, neither is MAX

I am trying to find the largest value on row across 3 columns. I have tried several methods and they have all failed. Original Data: | max_adsl_predicted_down | max_sfbb_predicted_down | ...
0
votes
0answers
12 views

SQL to create Table in PostGres DB for an existing Table in SQL SERVER, providing the Table name on SQL Server

I want to create a SQL Script on SQL Server which takes table name as parameter and splits out create table statement in the format of PostGres. Approach i am taking here is to fetch the table names ...
0
votes
1answer
24 views

group Concat in sql server 2014 [duplicate]

I have query like this select PersonalCode , TransferUnitTitle from Qry_TransferHistory join vw_MasterSimple m On m.Emp_Num = PersonalCode and result is: PersonalCode TransferUnitTitle ...
0
votes
0answers
46 views

sql server reading with nolock causes wait for same query executed in parallel

I'm actually facing performance issue with some data I'm displaying on my homepage. I have a query running some select with CTE and for every table I added a WITH (NOLOCK) to be sure that the reading ...
0
votes
0answers
13 views

Nginx to proxy SQL Database URL

I have an SQL server with IP say 1.2.3.4. I also have an Nginx Server I use as a proxy server for creating subdomains and mapping them to other services I control however, I am unable to connect to my ...
0
votes
1answer
39 views

EF Core code-first creates databse but it's nowhere to be seen

I'm developing an ASP.NET Core application and decided to introduce EF Core with code-first migrations. I created a DbContext class, and registered it in Startup class. For connection string I've ...
-7
votes
2answers
65 views

Store procedure and parameter type Nvarchar? [closed]

I have 1 store proc to Update and 1 parameter type Nvarchar to Do it, when i exec this proc: EXEC dbo.Update_CustomerOrder @address = N'' CREATE PROC Update_CustomerOrder @address NVARCHAR(50) AS ...
0
votes
3answers
46 views

Why in sql server can't return proper error in decimal data type conversion? [duplicate]

When I write query like Select 3 + '44. 5' It gave me error conversion failed when converting varchar value to '44. 6' to data type int Why it can not return proper error for decimal cannot ...
0
votes
3answers
47 views

Trying to show multiple various number to show it as text

Trying to figure out where I went wrong with this one. I tried to add number values 0-7 a varchar value and it gives me error: Msg 156, Level 15, State 1, Line 6 Incorrect syntax near the keyword ...
0
votes
0answers
11 views

sqlsysclrtypes.msi After publishing an Application

I just finished an application winform and i published it via oneclick application after i intalled it on my client's PC .. .i receive this error message while installing I read some articles about ...
0
votes
1answer
35 views

Trouble viewing rows not affected from UPDATE using temp table

I need to update some 600+ rows of customer data, using a query I've generated from Excel. I'm generating my update query using data that is more recent than the data we have in our test environment - ...
-1
votes
0answers
27 views

How to get the preivous days data excluding days where data does not exist? [closed]

I have a situation where a production line can run the weekend but sometimes does not. I need to get yesterdays run data for both situations. For example, if we did not run this past weekend, I need ...
0
votes
0answers
20 views

Running SSRS Query gives blank results

When I run this Query in SSRS the table does not fill out. There should be about 200 rows but all I get is this: Here is the Query: SELECT tblDataPermit.ApplicationNumber ,tblDataParcel....