Questions tagged [sql-server-2008]
Use this tag for questions specific to the 2008 version of Microsoft's SQL Server.
53,823
questions
0
votes
0
answers
16
views
Migrating Database in MySql
I am migrating database from Microsoft SQL Server to Mysql server
An error occurs when selecting "Microsoft SQL Server" option from Database System
The following is the error:
connection ...
0
votes
0
answers
14
views
Java Project SQL Server Update Query Not Updating Table, No Errors [duplicate]
I'm working on a Java project that interacts with a SQL Server database. I'm trying to perform an update operation on a table using a SQL update query, but it doesn't seem to update the table, and I'm ...
-2
votes
0
answers
44
views
Need to write a SQL query depending on flag status
I have a table StatusTable with a Flag column with values 'I' or 'E'.
So depending on the flag value, I need to change where condition of the SQL query.
For example:
Select a.col1, b.col2, c.col3
from ...
-1
votes
0
answers
37
views
Check If a row value is present in another table within a group
I have a requirement to check if the value from the master table is present in the transaction table within groups.
Master table:
ID
Item
1
Home
2
Admin
3
Users
4
Roles
5
Deals
Transaction ...
-2
votes
1
answer
73
views
My SQL statement with 2 INSERT commands is failing on the second INSERT
I have the following 2 INSERT statements:
-- Create a new database entry for the astronomicalObject in the GradObservers database
-- based on values of the given id
INSERT INTO astro.bodies (id, title,...
-4
votes
2
answers
43
views
How do I find doctors who work in the same specialty but live in different cities using SQL Server
The goal is to select all doctors who work in the same specialty, but come from different cities. I tried the two code options below but they didn't produce the desired results.
Image of doctors table
...
0
votes
1
answer
37
views
Node TS API container is unable to connect with SQL Server
I’m trying to run a container from my backend application, but I can’t connect to my SQL Server (mssql), I get the following error:
ConnectionError: Failed to connect to = 192.168.0.190:1433 - ...
0
votes
0
answers
49
views
[DBNETLIB][ConnectionOpen (SECCreateCredentials()).]SSL Security error Communicating with Win 10 OS
I'm getting this error when my windows application communicating to SQL Server 2008 R2.
Application framework .Net framework 4.6.2
[DBNETLIB][ConnectionOpen (SECCreateCredentials()).]SSL Security ...
-2
votes
2
answers
49
views
Display Parent Records After Related Child Records in SQL Server
declare @t1 table
(Id int,
Name nvarchar(200)
)
declare @t2 table
(Id int,
t1Id int fk,
Name nvarchar(200),
Amount decimal(18,2)
)
declare @t3 table
(
t2Id int,
t1Id int,
Name nvarchar(200),
total ...
0
votes
0
answers
160
views
Cannot get .Net Framework 4.8 to install on Windows Server 2012 Standard
I am currently running .Net Framework 4.7.03062 on my Windows 2012 Server. I ran the Offline installation of Version 4.8. It finished and said that version 4.8 was installed. When I look at the ...
0
votes
0
answers
48
views
Connecting to SQL Server view with Windows authentication using Python?
I have access to the following view in a SQL Server database:
[Serverlocation\Server].[Server.DW.Application].[Application_AdHoc].[DepartmentDailySummary]
I am a beginner, I do not know too much ...
-2
votes
1
answer
36
views
What are the default locations that OSQL and SQLCMD search to connect to a server when -S option is not specified?
I am trying to identify how osql and sqlcmd resolve server name and user to connect to that server when we do not specify server using -S option and use -E option. Below is the output for various ...
0
votes
1
answer
81
views
How to insert mm/dd/yyyy strings into a SQL Server datetime column using fast_executemany?
I am querying data from BQ. I have to insert it to SQL Server 2008.
pseudocode:
# get results from bigquery
client = bigquery.Client()
result = client.query(sql).result()
# create parametrized ...
0
votes
2
answers
55
views
Compare the Definitions of Two Tables
Is there a way to compare programmatically in T-SQL the definitions of two tables.
Not only the column names and the data types, but all definitions that are returned by:
sp_help 'table_name'
1
vote
0
answers
34
views
How to show all column names of a TEMP table [duplicate]
My goal is to show all the column names of a temp table called #foo. This will turn into a stored procedure that can display the field names of any temp table. But right now, it doesn't work for a ...
1
vote
1
answer
61
views
How to add a trigger to delete duplicates in table
Hi I have a table like this below:
[dbo].[table1](
[predictions] [int] NULL,
[timestamp] [datetime] NULL,
[train1] [int] NULL,
[train2] [int] NULL)
I'm inserting data into this table ...
0
votes
0
answers
148
views
Sequelize model methods (findOne,findAll,create etc) not working but sequelize.query methods are working on SQL Server 2008 database
I have done same sequelize methods with Postgres database all things are working fine.Whenever I make a connection to a SQL Server 2008 database and hit the model method, I got the error and I am ...
0
votes
0
answers
10
views
Errors when connecting to an offline .cub file by using C# ADOMD Connection
I'm trying to connect to an offline .cub file via ADOMDConnection
ADOMDConnection aConnection = new ADOMDConnection();
aConnection.ConnectionString="DataSource=D:\Downloads\Market\updated.cub;...
0
votes
0
answers
64
views
Implicit Conversion happening
Issue Description:
I am using Springboot 2.7.9 and microsoft sqlserver as database. Spring data Jpa sends BigDecimal datatype as decimal(38,0) to MssqlServer where column is defined as decimal(12,0) ...
-1
votes
2
answers
57
views
Selecting rows, where a column is at its minimal value [duplicate]
The otherwise identical rows here can sometimes differ by a numerical value of one column, let's call it Group:
Col1
Col2
.....
Group
A
B
100
A
B
200
A
C
100
A
D
200
For a particular value ...
0
votes
1
answer
49
views
How to update SQL Server database column
I have a table called Table1 that looks something like this :
MEID Type
KELO mb
OLEM mb-sd
And another table called Table2:
MEID SD
KELO NO
OLEM YES
I'm updating Table2 SD column like this :
...
-2
votes
2
answers
67
views
Create view with if statement
I have a query where the result changes according to the parameter. I have created a stored procedure to show what I need. I want it in a view so that I can join with other tables.
CREATE PROCEDURE [...
-2
votes
1
answer
72
views
I want to apply unpivot function in SQL Server and Sqllite [closed]
I have below table
Monday
Tuesday
Wednesday
Thursday
Friday
WeekStartsOn
8
8
8
8
8
2019-09-06
I want to convert it to below table
DayOftheWeek
ActualHrs
WeekStartsOn
TimecardDate
Monday
8
2019-09-...
-1
votes
1
answer
67
views
T-SQL in SQL Server 2008 and later : standard function to escape string variable that is going into a like comparison
I have user input coming in a parameter which then goes into a query to do a wildcard search.
Similar to:
DECLARE @myVariableContainingUserInput VARCHAR(50) = 'part of string';
DECLARE @myTable TABLE ...
0
votes
3
answers
71
views
Rolling up Values into Weekdays
I have a Basic SQL Query which looks at the SalesOrders table of our database, and shows all sales "per day" for a specific Sales Rep.
;with date_cur_month as(
select convert(datetime, ...
1
vote
3
answers
73
views
Splitting column from one record into multiple rows
I have the following customer data in SQL Server 2008:
Table name Customer_Note:
Note_ID
Customer_ID
Note
1
99
This is a note I am adding to the record and its a very long record indeed
2
102
Note ...
0
votes
1
answer
41
views
MS SQL Sort Alphanumeric values (1, 2, 3, 5, 6, 7, 9, 10, 4a, 8a, 4b, 8b) [duplicate]
In SQL database (2005/2008), I have a field named Ordernumber having the following values: 1, 2, 3, 5, 6, 7, 9, 10, 4a, 8a, 4b, 8b I want a way to sort them to be 1, 2, 3, 4a, 4b, 5, 6, 7, 8a, 8b, 9, ...
-1
votes
1
answer
127
views
Angular app creates 500 error code when running it locally
I have an Angular app which gives me a 500 error code when run it locally and try to create an account. I run the application on my laptop, the database is on my laptop too.
The database is using ...
-1
votes
1
answer
56
views
Joining 2 tables with many-to-many id's, but returning 1 row [duplicate]
Table A joins to TABLE B on an ID. Table A column sometimes has a csv of ID's. I'm only interested in the first ID for the join. The 2nd problem is that table B sometimes has the same ID multiple ...
-3
votes
2
answers
68
views
Grabbing left side of comma in returned SQL result for JOIN
Table A joins to TABLE B on an ID. The problem I'm finding is that sometimes in table A, the returned column for ID is multiple ID's Separated by a comma. So what I'm trying to do is just to a join ...
2
votes
1
answer
851
views
ASP.NET Core real-time data change notification with MSSQL Server
I have a database in MSSQL Server. I want to get notified when there is a change in specific table i.e on insertion and deletion of record it update the table in real-time with SignalR hub without ...
0
votes
2
answers
79
views
Conversion failed error during trigger execution
I have created a trigger on the student table and when the dropped status is turned to true, I have to delete that student from any group he is part of and add him in another log table.
The studentid ...
0
votes
1
answer
174
views
Stored procedure for table search without cycles or cursors
I have a view vwValues in my SQL Server 2008 database with these columns:
ExamObjID (uniqueidentifier)
Locus (varchar(10))
ValOrder (tinyint)
Value (varchar(5))
IndexType (char(1))
PersCount (tinyint))...
0
votes
1
answer
120
views
Why is this query blocking other queries from running?
Here's my entire script:
IF OBJECT_ID('tempdb..#Products_temp') IS NOT NULL
BEGIN
DROP TABLE #Products_temp
END
GO
SELECT p.product_id, p.price, p.cost, i.qty
INTO #Products_temp
FROM ...
0
votes
2
answers
399
views
Laravel make an autoincrement code/records and will reset daily
I'm trying to make an autoincrement code with date and it will reset the code on the other day.
I have this migration.
public function up()
{
Schema::create('records', function (Blueprint $table) {...
0
votes
0
answers
29
views
spring boot datasource not able to connect MSSQL database where user is in Active Directory
There is an user testuserAD in Active Directory and password tuAD!.
also, In MsSQL DB new user testuserAD added to database TestDB and have read write access.
Again,
In MsSQL DB server new testuserAD ...
0
votes
1
answer
53
views
Is this a correct way of returning a SqlDataReader from a function?
Here's my function I use for convenience:
Function executeSQL(ByVal sqlConn As String, ByVal sql As String) As SqlDataReader
Dim sdr As SqlDataReader
Dim objConn As SqlConnection = New ...
0
votes
3
answers
55
views
How to get running percentages or earliest date
I have a table with MemberID, MemberName, ReportingQuarter, FinalExpectedDay. I need to find the earliest FinalExpectedDay where the Member will have completed 3/5 (60%), 4/5 (80%), 5/5 (90%).
Here is ...
-3
votes
1
answer
66
views
Microsoft SQL server doesn't connect
I am trying to connect to a server but I confront this email several times. I've tried restarting SQL Server and SQL VSS writer still doesn't work. Here is the exact error
Cannot connect to LAPTOP-...
0
votes
1
answer
20
views
Database call clarification on rs.getString("columnName")
we know using Jdbc driver we connect to DB , and rs.next() points to cursor , my question is when we read each columns data using rs.getString("position of column/name of the column),
My Question ...
0
votes
0
answers
57
views
How to programmatically determine the state/structure of an SQL Server trigger via SQL itself?
The company I work for has a product that makes use of SQL Server 2016, with 2008 as an absolute functional minimum, and uses Liquibase to push updates to that database.
There is a trigger on a table ...
0
votes
0
answers
59
views
created cases and closed cases in the last 7 days
created date created cases closed cases teams
6-03-2023 9 7 abc
7-03-2023 8 8 abc
8-03-2023 7 9 ...
0
votes
1
answer
60
views
SQL Server - Fill date range gaps
I have records of employee employment that contain date ranges. There are some gaps between employments. I need to fill the gaps with date ranges and set them to inactive. All employees are to be ...
0
votes
0
answers
24
views
SQL 2008 into Excel autosave
We have an excel file that get auto-populate with information via SQL 2008 query even when this file is not opened on the computer. Now my question is as following: How can I save the excel file ...
0
votes
0
answers
32
views
Is it Possible to Connect Two Tables from Different Servers on MS SQL Server?
I would like to know if is possible to connect two tables from different Servers on MS SQL Server. If so, how do I do this? If it is not possible on MS SQL Server, is there any RDBMS able to do it?
1
vote
2
answers
59
views
How can I write a query where I can get different name values?
I have an table similar to the one below.
ID
Name
Surname
Grade
1
A
K
10
2
B
L
20
3
C
M
30
4
A
N
40
5
C
O
50
How can I write a query where I can get different name values? For example, the ...
0
votes
1
answer
39
views
How to use composite key with join in SQL
I have these tables:
ACCOUNTS:
BANK_ID (PK)
BRANCH_ID (PK)
ACCOUNT_NUM (PK)
CURRENCY
20
621
1001
ILS
20
623
1002
USD
20
90
1003
GBP
AMOUNTS:
ACCOUNT_REC (PK)
AMOUNT
20 621 1001
10000
20 623 ...
1
vote
0
answers
164
views
Do SQL Server temp tables live in memory even after the script finishes executing?
If I have a stored procedure that users are running constantly that creates temp tables and don't clear these temp tables at the end of the stored procedure, do these temp tables continue to exist and ...
1
vote
0
answers
50
views
SQL Server 2008 - nvarchar concatenation cuts off ISNULL() replacement value
I have a stored procedure in which I have a default WHERE clause nvarchar with the following:
DECLARE @DEFAULT_WHERE NVARCHAR(MAX)
SET @DEFAULT_WHERE = N'RTRIM(LTRIM(DD.CODIGO)) = ' +isnull(''''+@...
0
votes
0
answers
44
views
SQL Server : Freetext search with And Operator
Project table Name columns contains this data:
USA Russia England Canada
Canada
Query:
SELECT name
FROM project
WHERE FREETEXT(name, '"USA Canada"')
Result: the query returns both rows.
...