How are we doing? Please help us improve Stack Overflow. Take our short survey

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
6 views

SQL agent job creation error: Job 'XXX' is already targeted at server 'YYY'

I am trying to create and SQL agent job on SQL Server 2016. Here is the use of sp_add_job. EXEC @ReturnCode = msdb.dbo.sp_add_job @job_name=N'TEST_RUN_A_JOB_STEP', @enabled=1, @...
0
votes
1answer
23 views

How to get a value between a range of varchar string in SQL

I need to search for a value between two strings that are varchar. I have two tables: #Code: StartList EndList Code 1 3 A 4 7 B 20 25 C 1a 1e ...
1
vote
2answers
23 views

SQL Server 2012 - Rolling counter with reset

I am using SQL Server 2012 and want to get total of login unsuccessful attempts. My table has | Login_Name | Is_Success | Login_Date | My query is select login_name, sum(case when is_success = 1 ...
-1
votes
0answers
30 views

SQL Statement to convert Currency [closed]

I am trying to create a SQL Statement that would give all the rows in the Order Line Transaction Fact table converted into a different currency. For example, lets say the local currency is CAD and we ...
0
votes
0answers
7 views

SSMS access to SQL Server via SSH tunnel

I'm trying to use SSMS to connect via a SSH tunnel (using Putty) to a SQL Server default instance running on an AWS server. I can establish the tunnel and access data in the DB using SQLCMD from a ...
0
votes
1answer
24 views

Convert numbered categories to named categories

I'm sure there must be a simple solution to this. I've got two tables one with Stock Data and another where items category names are saved. So let's imagine the Stock table ID | Name | ...
0
votes
1answer
15 views

Row number for for same value

The result of my SQL Server query returns 3 columns. Select Id, InItemId, Qty from Mytable order by InItemId I need to add a column, call it row, that starts from 1 and will increase by 1, based on ...
0
votes
0answers
13 views

Timeout error connecting Python to SQL Server

I am trying to connect to my Microsoft SQL Server using Python(it's a local database, not remote): conn = connect('Driver={SQL Server};' 'Server=DESKTOP-censored;' '...
0
votes
1answer
36 views

SQL Server 2019 CHARINDEX returns weird result

When I run the following query in SQL Server 2019, the result is 1, whereas it should be 0. select CHARINDEX('αρ', 'αυρ') What could be the problem?
-2
votes
1answer
29 views

SQL Server PRINT statement in stored procedure is being concatenated with RAISERROR message by System.Data.SqlClient

My fairly simple stored procedure does this on line 44: IF @a = @b RAISERROR('blah blah blah', 11, 1) RETURN The stored procedure is invoked client-side using the .NET Framework System.Data....
-1
votes
2answers
31 views

Output the result of stored procedure

How can I simplify this stored procedure? It works but I think there is a better way than what I have. SELECT TOP (1) TD.FoodName, SUM(TD.Number) AS OrderCount INTO #Stemp FROM tblFactor ...
0
votes
3answers
26 views

Run a Select query based on result from other query

I have a table with 2 column with numbers col1 and col2 that are populated with a couple 1000's fields. i first run the following code: select top (10) PERCENT col1 from newtable for this query i get ...
-3
votes
0answers
33 views

How Can install SQL? [closed]

Please Help... I'm having the same issues with 2014 , 2017 and 2019 setup. Which DLL i need? Error2017 Error2019
0
votes
2answers
17 views

how to merge multiple rows into single in MSSQL

this is my data: id segment country product status month year 83916512 Government Null Null Null Null 2014 83916512 Null Germany Null Null Null 2014 83916512 ...
1
vote
2answers
32 views

SUM Function with WHERE clause for each sum?

I have two tables: Staff and Hours. Staff(200+ rows) with: Staff_ID, Name, Position each staff member only appears once in this table Hours (1000+ rows) with: Staff_ID, Hours, Amount, BillableFlag, ...

15 30 50 per page
1
2 3 4 5
19642