Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Questions tagged [sql-server]

Microsoft SQL Server is a relational database management system (RDBMS). Use this tag for all Microsoft 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
0 answers
10 views

Query for select all rows between events

I have dataset with sessions of users: date, userID, source of session, event type (interested in registration). How can I get all rows of sessions of each userID before registrations?
0 votes
0 answers
21 views

SQL Server Activity monitor & explain plan truncates the query

SQL Server Management Studio 17.2 SQL Server 2014 (v12.0.6329.1) I'm trying to track down a problematic query. I'm looking at the Activity monitor and when I try to view the whole query, it's ...
-1 votes
0 answers
30 views

Creating a list for autocomplete

I have a tables in my database for Countries/State/Cities and another one for Breweries that link to a city. How do I structure a query to return the data for an autocomplete widget? Currently my ...
0 votes
0 answers
18 views

SQLAlchemy Python 3.8 work with renamed columns [duplicate]

I'm trying to execute the following query : # query lookback = 5 query = f""" SELECT token, DATEDIFF(day, dt_utc, CURRENT_TIMESTAMP) AS dt_diff FROM dbo.TokenRegistry WHERE ...
0 votes
0 answers
38 views

Handler dispatch failed; nested exception is java.lang.AbstractMethodError

I don't know what can I do, anyone can help me ?? <!doctype html><html lang="en"><head><title>HTTP Status 500 – Internal Server Error</title><style type=&...
  • 1
0 votes
0 answers
28 views

How do I resolve an OBDC connection failure in old C++ app?

We have an old C++ server app (written with Visual Studio 6) that continually connects and disconnects to a Sql Server database. This app runs continually as a service, and most of the time everything ...
0 votes
0 answers
67 views

Spring transaction executed in MS SQL using a lot of memory

I am refactoring a java/spring application that uses MS SQL. There is an automated process that runs for some 10 minutes and when it does it uses a LOT of memory. The basic logic is: Pull up a number ...
0 votes
1 answer
56 views

How to use PERCENTILE_CONT without over clause? any alternative to it?

I am interested in finding median of an entire column in MS SQL Server and I don't wanna partition/subset column based on some other attribute. I am looking for a way to use PERCENTILE_CONT without ...
  • 3
0 votes
0 answers
53 views

Filter SQL Server database and fdctable whilst typing in TEdit box

I use this code in the edit.change in my Delphi program and fdac with SQL Server. Code: procedure TForm1.Edit12change(Sender: TObject); begin fdctable.Filtered := False; if Trim(...
-1 votes
0 answers
73 views

How can I sort a table using a calculated column?

I used @forumula with native query but I receive this error : Incorrect syntax near '.'. at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:262) I found ...
-1 votes
0 answers
42 views

Choosing the appropriate PK in SQL Server table [closed]

I have a the following classic schema structure I've read many articles and still haven't been able to come to a conclusion on how best to define the PK, FK and the clustered index in my case The ...
-2 votes
0 answers
49 views

Cannot find an application associated with the given consumer key [closed]

I am using the SQL Server database for WSO2 API manager 3.2.0 and want to use analytics. When I changed the database to SQL Server, this error appeared. I use mssql-JDBC version 8.2.2.jre8. I also use ...
0 votes
1 answer
45 views

Restoring a database with ASP.NET MVC using C#

I have been working on implementing a stored procedure to restore a database from a .bak file in an ASP.NET MVC application written in C#. However, when trying to execute the restore stored procedure, ...
0 votes
0 answers
35 views

How can I get records from current date for every month [closed]

How can I get dynamically records from my table according to today's date, for example if today is 10/01/2022, it will show me data for 10/01/2022 and 09/01/2022 ?
  • 27
3 votes
1 answer
32 views

FInd records 1 year older/newer than dates given in the same column, for each ID#

I need to find if a customer has a subscription the previous year and the following year, and how many subscriptions were new or were canceled the following year. Sample data: ID Subscription year 1 ...
  • 31
0 votes
0 answers
31 views

How to Manage 3 Or More File Streams SQL Server

I am working With SQL Server File Groups and File Stream Feature. I have 4 attachment tables which each one keeps specific type of attachments. Each table have a BLOBData column which is VARBAINARY(...
-1 votes
1 answer
71 views

Delete all service broker message types

Currently I am using: SELECT * FROM sys.service_message_types to list service broker message types. However, how would I go about deleting all message types?
-2 votes
0 answers
29 views

Query plan showing sort vs hash match because of extra field in groupby [closed]

I am trying to debug my modified stored proc and a part of it is showing an extra sort because of an additional field in group by clause. I am unable to post the query because of copyright, however ...
  • 1,732
-2 votes
0 answers
26 views

'Invalid object name' after import data [closed]

'Invalid object name' still appear even I'm choosing the correct database, however the table still can show up after execute the code. Is there any solution to solve this in order can type out the ...
-2 votes
0 answers
52 views

Uploading and reading XML Error-System.Data.SqlClient.SqlException: 'Error converting data type nvarchar to int.' [closed]

I have a dropdown which has 3 items. This is my stored procedure for the drop down BindDropDown, when executed contains Config_id & Config_type, also, therefore dropdown has Config_id || ...
0 votes
0 answers
127 views

Why Can't I Add a Column using Alembic Because it isn't in the Table?

So I'm trying to use alembic to add a column to my table. Here's my class defining the table with the new line in bold: class Account(db.Model): id = db.Column(db.Integer, index=True, primary_key=...
  • 297
1 vote
2 answers
81 views

Getting number of fouls per team per year for soccer

I am trying to get the number of red-card fouls per team per year for soccer. Here is my sample data, followed by the DDL+DML. soccer_team team_id team_name 1 Team A 2 Team B 3 Team C match ...
0 votes
0 answers
68 views

sqlalchemy error when attempting to execute SQL Server stored procedures

I'm getting the error "mapping or sequence expected for parameters" in the method below. These stored procs do not have any parameters, however, I'm not even sure the sprocs in and of ...
  • 701
-2 votes
1 answer
61 views

Why is the index size so unjustifiably large?

I have a table with 280k rows. It has a clustered primary key. When I look at the size of the primary key index, it reports 5.8 GB. Far too big for 280k rows. SELECT i.name AS IndexName, SUM(...
  • 57.5k
-1 votes
1 answer
64 views

How to add alias column in SQL Table?

I need some assistance. I have pursed the City name from the purchase address with the alias "City" . Now I have a I have a problem statement saying "Find the top cities with the ...
0 votes
1 answer
67 views

Why does selecting all columns change the order

I have 2 tables. The order of selecting with a select * is different than the order of selecting without the wildcard. This issue is happening on a production environment. I have tried to replicate ...
-1 votes
1 answer
58 views

Why can't I insert this data into my fact table?

INSERT INTO stage.FactPitch(GameID, AtBatID, BatterID, PitcherID, PitchType, Code, Date, Zone, px, pz, SpinRate, SpinDirection, x0, y0, z0, pfx_x, pfx_z, vx0, vy0, vz0, BreakAngle, BreakLength, ...
-1 votes
0 answers
113 views

UPDATED: SQL Cursor Fetch the Next Best Value

I started with these 2 tables. The Transaction table shows the transaction history for the customer, John. It shows which Room John leased on the Transaction Date. The Discount table shows the ...
  • 581
0 votes
0 answers
62 views

Error SQL72014 occured While importing database bacpac file in Azure SQL Server

I am trying to import the database into an Azure SQL Server. I have a database .bacpac file which I stored in an Azure storage container. The import process failed in a few minutes with the below ...
  • 1,180
0 votes
1 answer
34 views

How to remove 'before' key from payload generated by debezium event for updates in SQL server

For every update in SQL server, debezium generates event payload with 'after' and 'before'. I want to get rid of 'before' without flattening the payload. Use case: I am using debezium with Kafka and ...
0 votes
1 answer
64 views

SQL Server joined tables doesn't filter records as expected

I have 2 SQL Server tables which I'm trying to join and get this expected output but not working quite. The table OECMTHST_SQL contains multiple rows which share the same real_ord_no number also in ...
  • 91
-2 votes
0 answers
52 views

How to write a stored procedure to trigger a SSIS job and another stored procedure [closed]

I have a database DB1 with 3 tables. Whenever these tables change, I want to trigger a SSIS job that moves data from these 3 tables to corresponding tables on database DB2 and then execute a stored ...
0 votes
1 answer
69 views

why is SELECT COUNT(*) FROM my #temporary table slow? (Or: How to get COUNT(*) of a temp table without COUNT(*)?)

I need to determine the number of rows of a temp table in SQL Server. The obvious way to do it is select count(*) from #table The problem is that if the #table is huge, count(*) takes too long. I am ...
  • 41
0 votes
1 answer
53 views

Passing empty from excel vba data to SQL Server

How to pass empty or blank values in excel vba to SQL Server? When my code starts to read blank cell the next succeeding cell will be blank too even if they have data in it. I tried first to put null ...
0 votes
1 answer
61 views

Implement a set of parameters in ssrs which are dependent on each other in any order

I have 4 columns in a table Continent Country State District APJ India punjab Tavi APJ India punjab xyz APJ India punjab abc ...
  • 251
0 votes
0 answers
18 views

Flat File Source returned status value 2 and status text The value could not be converted because of a potential loss of data

in the destination database I have a decimal field (15,2) and in the source of the etl the field is in a csv file, automatically ssis recognizes it as DT_STR data type what I did was change it to ...
  • 13
1 vote
0 answers
43 views

Query Optimizer choosing non-filtered index instead of filtered

I want to create a index for this query: SELECT TOP (100) HORA_LEIT FROM DADOS WHERE COD_PONTO = 610 AND HORA_LEIT <= '2022-09-29 12:25:00.000' AND VAZAO IS NOT NULL ORDER BY ...
-2 votes
1 answer
44 views

Splitting Comma Separated string in TSQL and converting result into rows

Can some one help me in this case? I have this table input ID BuildingName Rooms Details Contact 1 BurjKhalifa 2,4-9,12 RoomsAvailable +971-12-0000 and I want this output ID BuildingName Rooms ...
-1 votes
0 answers
23 views

SQL Server: Joining Tables where table 2 has multiple entries for same primary key

I am trying to join two tables. Table1 contains the following relevant information AccountID_T1 Information Table2 contains the following relevant information AccountID_T2 AccountName In both ...
  • 29
-3 votes
0 answers
28 views

Extract primary keys from all tables in SQL Server database [closed]

I would like to get all the primary keys for all tables in a SQL server database. Could anyone provide a query to do this? Thanks!
  • 1
0 votes
0 answers
29 views

How Can I Connect to a Remote SQL Server From a Local Postgres Database Using Postgres_fdw?

I've been working on a major project that compares data from multiple data sources. I've been using postgres_fdw for this and I've been successful in retrieving data to my local postgres instance from ...
-1 votes
0 answers
50 views

Covering index in Typeorm [closed]

Is it possible to create a covering index in typeorm? If so, how?
  • 2,191
0 votes
0 answers
46 views

C# SQL Server - Invalid attempt to read when no data is present [closed]

I've been stuck in this problem for hours and it seems that any method that I use to display data from the database to textboxes is not working. Here is the snippet of the whole code public ...
  • 29
-1 votes
0 answers
47 views

LEFT JOIN DOESN'T WORK AFTER SELECT SOME COLUMNS [closed]

I made time ago a pivot table with left join in SQL Server like this: SELECT * FROM [CClientes].[dbo].[TransparencyAtlas] AS tabla LEFT JOIN (SELECT * FROM (...
0 votes
2 answers
50 views

how to access the data from SQL Server which is in JSON format using ASP.NET WEB API controller

I have created a stored procedure in SQL Server which returns in json format ALTER PROCEDURE [dbo].[GetAllRoles] AS BEGIN SELECT * FROM dbo.roles FOR JSON PATH; END Output of this ...
  • 27
0 votes
1 answer
46 views

Troubleshooting Conditional Grouping with CASE (SQL Server 2008)

I'm hoping that someone is willing to help. I'm new to SQL and struggling to get a simple query debugged. I want to create a simple frequency table to see how many values are missing (i.e. = 00000000) ...
0 votes
0 answers
30 views

Automatically Save Query Results to Excel

I have a simple query that I want to run and save the results in excel file on daily basis. I am trying to create a SSIS(SQL Server Integration Services) package to automate this thing. My query is ...
0 votes
0 answers
47 views

While loop never exits dynamic SQL [closed]

I am trying to write a script in dynamic SQL that will create views based on all tables available in the database. So I create a temporary table that will store everything and later be removed. ...
0 votes
0 answers
38 views

Create a trigger for a discount on a plane ticket

I need to create a trigger where I need to check how many plane tickets the passenger has bought in one specific year. If the value of all the acquired tickers that year isgreater than $1000, or if ...
0 votes
0 answers
35 views

I can't make a connection to sqlserver with oracle

I'm training in java J2E perspective (on eclipse) and I would like to make a connection with SQL server. But even if my driver works (mssql-jdbc-11.2.0.jre17), I can't get a connection in the next ...

1
2 3 4 5
6464