Category "sql-server"

SQL - The conversion of a varchar data type to a datetime data type resulted in an out-of-range value

I have been getting the following error when running a SQL to convert my data type value from varchar to datetime. Msg 242, Level 16, State 3, Line 1 The

Select the field as Distinct having data type as Text. Sql Server

Is their any way to select a field as Distinct whose data type is Text. If we have a table T1 with a field named Subjects have data type as Text. Subjects -

Docker initialize database tables and records in SQL Server

How do you specify initialization database script for SQL Server via docker-compose using SQL script file? docker-compose.yml database: image: microsoft/m

Dynamics NAV SQL Lead Time format conversion

I have a small issue getting data, one field in particular, from table replicated from Microsoft Dynamics NAV. There is a field storing lead time in strange fo

Export database schema into XML file

I would like to export whole database schema to XML file. Information there what are needed. tables - columns, data type, pk, fk, views - returned columns, fun

Push an R dataframe to SQL as a new table

I'm trying to make my analysis workflow more efficient connecting my SQL Server Database to R-Studio. What I do now? I develop my queries using MS SQL Managem

Can I do a DAG with SQL Server HierarchyId?

I'm developing an organizational chart in SQL Server 2016. I have some employees report to multiple managers which make the data structure a Directed Acyclic Gr

Mssql loop with UNION t-sql

I just use Mssql procedure given at this site Using loop with UNION t-sql to build my own loop procedure. When I'm executing this code: SELECT '[hpsdb].[

How to Identify port number of SQL server

I Install SQL server in my system and I have to check on which port number SQL is working in my system

CONCAT_WS() for SQL Server

How can I emulate MySQL's CONCAT_WS() function in SQL Server? This function is similar to CONCAT() function in SQL Server 2012 except that it adds a separator

Error when connecting to MSSQL Server with Google Apps Script via JDBC

I'm trying to connect to Microsoft SQL Server using Google Apps Script. I'm using SQL Server 2008 R2 and I am using one of the suggested scripts that's supposed

Finding blocking/locking queries in MS SQL (mssql)

Using sys.dm_os_wait_stats I have identified what I believe is a locking problem wait type waittime pct running ptc LCK_M_RS_S 2238.54 22.14

SQL Server Maximum rows that can be inserted in a single insert statment

I want to do a batch insert, similar to this question How to do a batch insert in MySQL What is the limitation is SQL Server on how many rows can be inserted

How to read geography values using hibernate?

In my spring boot application, I am trying to store spatial data using spring data with hibernate (jpa). Full source code of minimal reproducing example is avai

SSIS loading data error

I have a CSV file which contains this data: EmployeeCode,EmployeeName,EmployeeSalary,Date 101,raju,1000,2/2/2003 102,krish,100,3/4/2005 103,rishbh,320,12/9/200

How to convert XML columns to rows in SQL database?

I am trying to import an XML invoice to SQL database. After some research, I have managed to put it in SQL database but it has x rows whereas it should be a sin

Check the perm 'Create Database' in PostgreSQL as well as in SQL Server

I would like to check the perm in PostgreSQL db as well as I do it via this command 'SELECT HAS_PERMS_BY_NAME(NULL, 'DATABASE', 'CREATE DATABASE')' for the SQL

PAUSED SQL Server still uses 20% CPU

SQL Server is always using 15% to 40% or more on a very lightly used database (maybe 40 users log in ONCE a day for literally a min or two). A small load proced

How to connect SQL Server with Rstudio?

I have downloaded Microsoft SQL Server on my Mac with the Docker image as described here, and also I have downloaded the database AdventureWorks2019 as an exam

Sql Server query varchar data sort like int

I have one table like CREATE TABLE table_name ( P_Id int, amount varchar(50) ) Data Like Id amount ---------- 1 2340 2 4568 3 10000 Now I want to sort t