Questions tagged [sql-server]

Microsoft SQL Server is a powerful and versatile relational database management system (RDBMS) developed by Microsoft. This tag encompasses all editions of Microsoft SQL Server, such as Compact, Express, Azure, Fast-track, APS (formerly PDW), and Azure SQL DW. Please refrain from using this tag for other types of database management systems like MySQL, PostgreSQL, Oracle, etc. Additionally, this tag should only be used to address matters specifically related to the database, not software or mobile development issues that are unrelated.

Having trouble establishing a connection to the SQL Server database in my React application

I'm stuck trying to connect my database with my React app. I created the database using SQL in SQL Server Management Studio. I attempted to use express for the connection, but it seems like there are pieces missing in my code. Can someone guide me on what ...

Pre-selected default value in select box using ng-options

I'm working on setting a default value in my select box, retrieved from the database, using ng-options. Here's my view: <select class="form-control samlength modalinput" ng-options="p.procid as p.procname for p in processes track ...

Tips for troubleshooting Node.js mssql promise issues

Is there a way to pass the response data from one SQL Server stored procedure into another stored procedure for logging purposes? I've attempted different methods but encountered issues with connection pools and errors like HTTP Status: 500, subStatu ...

Choose SQL query for grouping by nested JSON properties

My select query is providing data in the following format: [{ id: 'CB2FD8B7-7E6D-4BF3-8E73-70D41FFBE456', products: '[{"product_id":"22061DA1-5D64-475A-B36A-140ECFE8D6B7"}]', falconpay_api_response: null, dhl_updated_by: null }, ... ] My current ...

Sending information from one function to another in NodeJS using the MSSQL driver

Currently working with an SQL Server in NodeJS, and successfully pulling data. However, struggling to pass the retrieved data back to the calling function. Below is my code snippet for querying the database: const dbq = require('./dbquery.js'); ...

Tips for avoiding fields containing the symbol "$" in their name

Is it possible to query a JSON document that contains field names with special characters like "$id"? SELECT [ID] FROM OPENJSON( '[{"$id":42},{"$id":43}]', '$' ) WITH ([ID] NVARCHAR(25) '$.$id') WHERE ID = ...

I am consistently encountering a 500 error code while attempting to make SQL server queries

I am encountering an issue with querying data from my SQL server host on Microsoft Azure. When I attempt to query by PHP, I consistently receive a 500 error code; however, querying the same data through Visual Studio is successful. Could you please help ...

Divergent outcomes observed in MSSQL between SSMS and Node JS script

Recently, I encountered an issue with a SQL query that retrieves customer transaction headers based on their card_number. The query should return an audit_number column. Surprisingly, when executing the query in SSMS software, the results are correct; howe ...

Selecting a value from a populated dropdown and checking the corresponding checkbox in SQL Server

There are 8 checkboxes in this example: <table style="border-collapse: collapse; width: 100%;" border="1"> <tbody> <tr style="height: 21px;"> <td style="width: 25%; height: 21px;"><strong>Technology</strong& ...

Access the JSON data sent back from the MVC controller within the Angular controller

As a newcomer to AngularJS, I apologize if my question seems basic. I hope the title of my question is clear. I am currently using AngularJS with an ASP.Net MVC application to retrieve data from a SQL server table and display it on the view. While everyth ...

Managing database downtime with TypeORM

In the event that my MSSQL server experiences a crash and an app client makes a request to the API, the current behavior is for it to endlessly spin until Express times out the unanswered request. By enabling logging in TypeORM, I am able to observe the e ...

Is it Mission Impossible to Combine NodeJs, Restify, SQL Server, TypeScript, and IIS?

Starting a Rest API project using NodeJS with Restify on a Windows environment (local server with IIS and SQLServer) while also using Typescript may seem like a difficult task. Is it an impossible mission? Does anyone have any helpful guides, documentatio ...

What is the process for bringing data from a REST API into a SQL Server database?

My REST API delivers a JSON-formatted response that looks like this: { "Employees" : [ { "userId":"romin", "jobTitleName":"Developer", "emailAddress":"<a href="/cdn-cgi/l/email-protection" class="__cf_ema ...

When using SQL Server, Windows Authentication is successful when connecting through Management Studio but not when using Apache

My PHP application built with Codeigniter is attempting to connect to SQL Server 2016 using Windows Authentication. Encountering the following error message: Array ( [0] => Array ( [0] => 28000 [SQLSTATE] => 28000 [1] => 18456 [code] => 1 ...

Enabling the upload of .sql files in a file input field

I'm working on a file input field that I want to restrict to only accept XML, SQL, and text files. Here's the code snippet I have implemented so far: <input type="file" name="Input_SQL" id="Input_SQL" value="" accept="text/plain,application/x ...

Inquiring about the JSON data within a particular column

Initially, I saved my JSON data in a varchar column. Recently, I was asked to modify one of the fields in the JSON. How can I extract the specific field and update its value? Here is an example of a single record: { "name": "Bob", isSelected: "true" } I ...

troubleshooting problems when transferring data from MS SQL to MySQL

I am working with a MSSQL document that I need to convert to MySQL. One of the fields in MSSQL is named IMG and it has an image type, represented by a code similar to this: 0xFFD8FFE000104A46494600010101006000600000FFDB00430001010101010101010101010101010 ...

pyodbc connection makingit through direct pyodbc connnection but not working with sqlalchemy

Why is there a difference in how these two methods establish a connection to the SQL Server? sql_server = 'myserver.database.windows.net' sql_database = 'pv' sql_username = 'sqladmin' sql_password = 'password1' sql_driver= '{ODBC Driver 17 for SQL Serve ...

With the combination of SQL Server, Node.js, and bcrypt, the request finishes processing before the function is properly executed

I recently started learning nodejs and ran into an issue with my code. While following the SQL Server documentation and a tutorial on Youtube, I realized that my function is terminating after the request is complete, even though I am using .then() with bc ...

Issue with Retrieving a particular table from SQL Server using mssql in javascript ('dbo.index')

I am currently experiencing an issue with trying to access a table named dbo.Index from SQL Server in my node js express application. Unfortunately, whenever I attempt to do so, the operation fails and returns no data. Below is the code snippet in questio ...

Tips for sending a date parameter to an SQL Server query through NodeJS

I am currently utilizing node-mssql in my project with the following function: const getPoliciesDue = async (userId, toDate) => { const db = await sql.connect(config) // const sql = require('mssql'), config = {config for my DB} const request = db.r ...

The HTML form captures user input and transfers data from a SQL Server Management Studio database using Node.js and Express

I have successfully set up a database in SSMS with tables like Products, Subcategories, and Categories. I can run queries in SSMS and connect it to Node.js. My next task is to create a form that prompts the user to select a category from a dropdown list. U ...

Removing the key from the output of FOR JSON PATH in SQL 2016: A step-by-step guide

Lately, we have incorporated the usage of FOR JSON PATH in our SQL code for various reasons. However, I am currently facing a slight issue in a specific scenario. My aim is to obtain a JSON string containing a list of OrderItemIds. Instead, what I am getti ...

View the picture in a web browser

Currently, I am faced with the challenge of displaying an image that is stored in an MSSQL database created by another person. The column was originally of type IMAGE, but I converted it to varbinary(MAX) using Sequelize. Although I lost some data during ...

Tips for transforming an SQL Server query into JSON format

I need to construct a table in a view utilizing the output of this particular SQL Query SELECT f.empresaid, e.fantasia AS Company, f.filialid, f.fantasia AS Branch, u.consultorid ...

Prisma encountered an issue while attempting to establish a connection to the database

Working on my node/express project with Prisma and using SqlServer as the db. After completing all setup, everything seems to be functioning perfectly. Running prisma generate, prisma migrate, and prisma introspect from the CLI all work flawlessly with my ...

Tips for sending a timestamp as input to a stored procedure in TypeScript with the mssql module

Currently, I am utilizing the mssql npm package to communicate with SQL server. I have encountered a dilemma where the variable (which is of type TIMESTAMP in sql server) fetched from a stored procedure is returned as a byte array. Now, I need to pass this ...

Transforming dynamic JSON data into SQL Server using Azure Data Factory

I've been attempting to flatten a dynamic JSON structure and insert the resulting data into a SQL Server table without success. I've explored several methods thus far: Copy Activity: The JSON data from a datab ...

What is the best way to analyze Azure SQL data across development, testing, and production environments using Python?

My task involves comparing the number of rows in Azure SQL databases to ensure data quality. With approximately 50 database tables and occasional additions of new tables, I aim to develop a Python script that can connect to three environments and generate ...

Put JSON data into SQL database table

I have the SQL Table 1 shown below: id name gender age country ambition 1 Peter Male 20 Italy Doctor 2 Angeli Female 30 Australia Lawyer I need to insert data into another table using a similar approach. Here is how I want the output in SQL Tabl ...

Exploring the Interplay of JSON Objects in SQL Server and C#

After executing the following SQL Server query, I successfully created a JSON object: SELECT Attribute 1, Attribute 2, Attribute 3,... AS Identifier FROM Table_1 tbl1_obj INNER JOIN Table_2 tbl2_obj ON tbl2_obj.Id = tbl1_obj.Id FOR JSON AU ...

When querying a table for JSON_VALUE, it often returns null instead of the expected value

JSON data is stored in a column called 'DataJson' within a table [{ "KickOffDate": "1-Jan-2019", "TeamSize": "11", "ClientEngineer": "Sagar", "WaitingPeriod": "16.5" }] A query is performed to extract specific values from the JS ...

An unclosed quotation mark was detected following the character string in Node.js with sequelize

Whenever I input a sentence containing single quotes, an error occurs due to Sequelize interpreting it as the closing string. How can I resolve this issue? I attempted using the sqlstring module without success. (I am aware that doubling up the single qu ...

Dealing with unescaped double quotes in values while using JSON_VALUE()

I'm currently facing an issue with a table in my database where the field JSONDetail stores JSON data. The problem arose when we encountered unescaped double quotes within one of the values in this field, likely due to migrating from a system that allowed ...

The dynamic trio: Node.js, Sequelize, and SQL Server working together

I'm currently working with SQL Server 2005 and node.js, utilizing the following dependencies: "dependencies": { "sequelize": "^4.42.0", "tedious": "^5.0.3" } My objective is to set up this database structure: const con = require('. ...

Setting up MSSQL configuration with PHP 5.6.x (XAMPP) and integrating it with CodeIgniter

Encountering an issue setting up MSSQL DATABASE configuration with my codeigniter. The following files have been placed in xamp/php/ext: php_pdo_sqlsrv_56_ts.dll php_sqlsrv_56_ts.dll php_sqlsrv_56_nts.dll php_pdo_sqlsrv_56_nts.dll In addition, the dll f ...

PyODBC encountered Error 10054: TCP Provider reported that a pre-existing connection was forcefully terminated by the remote host when utilizing fast_executemany=True

I am attempting to upload a SQL file into a SQL server that is operating within a Docker container. Here is the docker-compose.yml file: version: '3.4' services: sqlserver: image: mcr.microsoft.com/mssql/server container_name: sqlserve ...

Getting the mssql output in Protractor using VSCode

I recently tried running the code below and it seems like the connection is established successfully. However, I'm unable to see any output. Is there a way to view the query result? I am still learning about Protractor, NodeJS, and MSSQL connections. cons ...

How Can I Utilize a URL Parameter Twice to Execute SQL Queries in Two asp.DataLists on a Single Page?

I've been trying everything, but I just can't seem to get one query to function properly. My goal is to retrieve information from the SQL Server database in two separate queries - one for album names (based on URL parameter) and another for song ...

Converting SQL Select Queries into JSON for Organizing Menu Layout

I need assistance with a query that can generate JSON output for creating a menu structure. I want to populate the Menu using this JSON data. Below are the details of the two tables I am working with and the query I have tried so far: SELECT c.ID As ...

Making changes to a specific JSON value within a JSON Array in SQL

I am looking to make changes to an existing JSON value within a JSON array. I have the ability to add a new JSON object to the array using JSON_MODIFY. For example, if my JSON looks like this: [{"id":"101","name":"John"}, {"id":"102","name":"peter"}] How ...

Establishing a connection to SQL Server through the use of Express.js

Having some issues with my code to establish a connection to SQL Server from express.js. I'm trying to handle errors by assigning them to a global variable and returning it at the end of the function, but for some reason the value is always undefined. ...

Retrieve numerous rows by utilizing the forthcoming SQL Server TSQL command for extracting data from JSON format

I'm attempting to fetch multiple rows using the SQL Server 2017 TSQL code from a JSON object. DECLARE @json NVARCHAR(MAX); SET @json = N'{ "DateCreated": "2020-08-02T16:04:59.3558001+01:00", "Name": "Bolts", &q ...

Reorganize child JSON objects into a new object that includes a parent ID

Exploring the realm of JavaScript, I am currently delving into Node.JS to interact with an API and save the data in a SQL Server. Utilizing the "request" and "mssql" Node packages for this task as they possess robust documentation and support. My query re ...

How to establish a connection between MAMP, PHP, and MSSQL

Has anyone had experience connecting to MSSQL using PHP? I am currently running a MAMP server and utilizing PHP as the server language. While I have successfully connected to MySQL, I am now needing to connect to another database in MSSQL. I attempted to ...

Steps to establish a connection between PHP and Microsoft SQL Server

I am currently using a dedicated CentOS server that needs to establish a connection with a remote Windows machine running SQL Server 2012. The provider has installed Freetds, and my PHP version is 5.3.28. We are able to ping the remote MS-SQL server from ...

Exploring the capabilities of traditional ASP.NET Web Forms

Seeking guidance on testing outdated legacy asp.net web forms. Many pages in our project were developed years ago and now the task of maintaining them or adding new features has become extremely challenging. The lack of organization is evident, with no de ...

Unable to successfully add data into an SQL database using PHP

I'm encountering an issue while attempting to insert data into the 'products' table within my SQL server. Despite my efforts, the table remains empty and I'm unsure about what's causing this problem. Here's a snippet of my code: <?php /* Defining the ...

Seamless Integration of Full Calendar Functionality with SQL Database

I'm currently experiencing difficulty in utilizing FullCalendar's impressive jQuery calendar plugin for my application, specifically in generating events from SQL Server. Here is the code snippet: First JS $(document).ready(function() { var date = ...

Example of locking in Sql Server for beginners

My understanding of SQL's locking mechanism has been challenged recently. I know there are shared and exclusive locks, and that multiple shared locks can be applied to the same data simultaneously. However, I am confused as to why query 1 does not block qu ...

Extracting Values from JSON in SQL Server Made Easy

My database in SQL Server contains a table with two columns: ID and JSON. The JSON column holds JSON-formatted text. I have access to functions like ISJSON, JSON_VALUE, and JSON_QUERY, but unfortunately not OPENJSON. I'm attempting to write a query t ...

What is the best way to divide an array of objects in SQL?

I am facing a situation where I have a table in my database with columns ID and Data. The data in the Data column consists of JSON objects containing "na" and "answer" fields. ID Data 1 [{"na":false,"answer":1.5},{"na ...

Combining two JSON strings within SQL Server

I am working with a dimension table that includes a JSON column and applying SCD Type 1 to update its values. string1={ "Name":"Suneel","Age":23,} String2={"Name":"Suneel Kumar","Age":23,"Cit ...

A step-by-step guide to extracting live data using cheerio and socketio

I am currently scraping data from a website using Cheerio. Can someone provide me with guidance on how to retrieve web data and automatically update it using socket communication when there are changes on the website? I want to make this process real-tim ...

Transform rows or table records into JSON documents within SQL Server

Here is some sample input data for your reference: if object_id('tempdb.dbo.#store_data') is not null drop table #store_data create table #store_data ([key] nvarchar(max),[value] nvarchar(max), storeid varchar(100) ) INSERT INTO #store_data VALUES ('sid ...

Error message "Unable to set headers after they have been sent to the client" occurs while using React Login form

Greetings, I am currently working on a full stack login form. The issue I am encountering is the error message ": Cannot set headers after they are sent to the client," which you can review in the full log provided below. My main goal is to develop a logi ...

Establishing a Connection between Node.js and SQL Server using Windows Authentication

I've been attempting to establish a connection between node.js and mssql in Windows Authentication mode. Despite installing the modules tedious,mssql, and msnodesqlv8, I'm still struggling to open a connection. This is my failed attempt so far: ...

Ways to hide this notification when showing the outcome in php

Having successfully connected to sqlserver using ODBC in php, I am able to establish a connection with the database and execute queries. However, the results I receive are not as expected. A notice is being displayed: server connected Notice: Use of un ...

Extracting an array of integers from JSON using SQL Server 2016

Upon receiving a valid JSON string from the client side, which contains an array of integer values: declare @JSON nvarchar(max) = N'{"Comments": "test", "Markets": [3, 151]}' The question arises on how to accurately select the market IDs. When attemptin ...

SQLSTATE[HY093]: The parameter number provided is invalid because the parameter was not defined

Encountering the error mentioned above consistently. The issue arises with my setup depicted below: $InsertSQL = "insert into reports.NonVarassetInvoices(State, CLLI, Type, Vendor, DateReceived, InvoiceNumber, InvoiceDate, TotalInvoiceAmount, ProjectWONum ...

A guide on populating an SQL Server table with data using a stored procedure in Python

I just started using pytds and encountered a TypeError: not enough arguments for format string error when trying to insert data into SQL Server. The problem I'm facing is: Traceback (most recent call last): File "c:/Users/mydesk/Desktop/test/test_p ...

Streaming SQL Server to Node.js using the MSSQL library

I am recently starting to explore the world of node.js and I'm currently working on establishing a connection to SQL Server using the mssql library. However, I find the example provided in the git repository to be quite vague, leaving me uncertain about ...

The variable req.body.Dates has not been declared

I am currently working on a project that involves dynamically populating two drop down menus using SQL Server. Depending on the selected items, I need to load a specific ejs template using AJAX. My goal is to load data based on the selected criteria. For e ...

Establishing a connection with MSSQL 2014 through Node.js

I've been grappling with this issue for quite some time and I just can't seem to figure it out. Here is the code snippet that I have been using: const sql = require('mssql/msnodesqlv8'); const pool = new sql.ConnectionPool({ server: '127.0.0.1', data ...

Executing Shell Commands with Child Process in Node.js

I am working with a function called xyz_users_list that returns a list of users when executed using exec xyz_users_list. How can I incorporate this into my nodejs application? Code index.js 'use strict'; const express = require('express'); const app = ...

Storing JSON data in SQL Server

Is there a way to eliminate spaces using the given query? The second input value (" DEF") and third input value ("GHI ") contain extra spaces. How can we remove these spaces? Here is the original query: SELECT * FROM openjson('[{"value":"12","te ...

Attempting to integrate information from an external API source

I am struggling with properly formulating a question in order to retrieve relevant search results. I am attempting to extract data from a third-party API (ADP) and store it in my database using asp.net core. My goal is to save the users obtained from the ...

Prevent the Insertion of Duplicate Rows in the Table

Let's imagine we have a basic SQL table: CREATE TABLE CarTable ( Model CHARACTER(10), Brand CHARACTER(10) ) Now, let's say we have added the following data to this table: INSERT INTO CarTable (Model, Brand) VALUES ('Thunderbird', &ap ...

My Node.js application is encountering an issue when attempting to establish a connection with SQL Server - nothing appears on the console, even in the absence of any errors

The following code snippet is from the index.js file. Upon visiting the link "localhost:300/admins/", the code is supposed to establish a connection with SQL Server and retrieve the result on the console. I confirm that my Microsoft SQL Server Management ...

Saving any type of file in SQL Server with a field type of varbinary(max) can be achieved by utilizing Angular with ASP.NET Core to create a REST API

I am currently facing an issue while attempting to save a file, such as an image, in the Microsoft SQL Server Management Studio through asp .NET core for the Rest API. I have managed to create a base64 representation of the file, but I am unsure about the ...

Troubleshooting Issues with PHP7 and SQL Server Integration on Windows Platform

Encountering a "Fatal error: Invalid handle returned. in" message in PHP 7 when attempting to connect with SQL Server. Tried the following options: Error connecting to MSSQL with SQLSrv and PHP 5.4.7 Unable to connect to SQL Server with PHP The code bei ...

NodeJS file execution through a stored procedure

Everything I've come across regarding the topic revolves around using a NodeJS program to call a stored procedure. Inquiring: Is it feasible to reverse this process? Can a stored procedure be designed to call/execute a NodeJS file/program instead? I'm cur ...

Generating JSON using a column as a key in Azure SQL

In my SQL server table, I have the following data: Name Value ValueHash city 111 zzz address 333 yyy email [email protected] xxx name 222 www I need to retrieve the JSON format shown below using a SQL query { "address": { ...

Utilizing Node.js on Linux to Connect to SQLServer

Looking to create a REST service using Node.js and Express but facing difficulties connecting to a SQLServer 2000 database. The Microsoft connector is not compatible with Linux, as mentioned by the developers: The Microsoft Driver for Node.JS for SQL Se ...

My values are failing to transfer to the SQL Server database without generating any error messages. What could be causing this issue

My current project involves using PHP code to post data submitted through a web form to a database table. However, despite my efforts, the data is not getting stored in the database. I have another similar page where the data posting works correctly with t ...