Category "sql-server"

MAUI Blazor Android Sql Connection

I am experimenting with Maui Blazor. I want to connect my application with an SQL server database. Therefore I used a simple Sql Connection String. When I test

How to create the linked server for SQL Server 2008 where we have the database from 2000 and 2005

Currently I am working on SQL Server 2000,2005 & 2008, my requirement is like, the database available in SQL Server 2000 & 2005 will be available in 200

Join two tables and return only one row from second table

I have two tables. Both tables contains an ID that can be used to join them together. However, table 2 can have more than one row for the same ID. Table 1 will

SQL query to determine that values in a column are unique

How to write a query to just determine that the values in a column are unique?

Correct use of transactions in SQL Server

I have 2 commands and need both of them executed correctly or none of them executed. So I think I need a transaction, but I don't know how to use it correctly.

mssql isn't an available database backend or couldn't be imported

I'm following this guide. Mssql-django and I have Django version 3.2.12 I already installed mssql-django 1.1.1 I also have pyodbc 4.0.32 modified my settings.py

How to insert into a table that specifies a DEFAULT value for every column?

I have a table where all columns are auto-populated whenever an insertion happens: CREATE TABLE … ( ItemID INT NOT NULL IDENTITY(…

ALTER DATABASE failed because a lock could not be placed on database '<db_name>'. Try again later

I really don't care what I do with this test database...it's for sandbox testing (attached to a production server instance)! All I'm trying to do is KILL all co

Guid.NewGuid() is returning duplicate values when used in a Parallel.For loop

I have an application that is hitting an API. As such, it does a query for all ID's in the object, and then has to query each item one at a time per ID. I'm d

Run xp_create_subdir without admin privilidges

The Point: I want to be able to create a directory on the filesystem through a non-sysadmin SQL user. I'm creating a web front-end for a deployment script whi

Could not drop object 'dbo.Table1' because it is referenced by a FOREIGN KEY constraint

Even though I am removing and trying to drop table, I get error, ALTER TABLE [dbo].[Table1] DROP CONSTRAINT [FK_Table1_Table2] GO DROP TABLE [dbo].[Table1] GO

How does Multiple Active Result Set (MARS) work in SQL Server?

Just wondering if someone could explain how Multiple Active Result Set (MARS) works in SQL Server as it is not very clear on the MSDN site. (A) On a MARS conn

SQL Server - Index maintenance for index with uniqueidentifier?

I got some non-clustered indexes (unique) with uniqueidentifier (GUID) as column. The index gets a lot of fragmentation all the time. How should I solve this

SQL Server unpivot multiple columns

I'm trying to pivot a table around it's many columns to get to 3 columns (pivot, column name, value) so for example: name | age | gender ------+-------+--

Cannot establish connection to SQL Server

I am trying to access SQL DB that is located on my computer from an application that is located on a server (has IIS7). I set the ConnectionString in the WebCon

Getting output of MS stored procedure on php call

I am using the sqlsrv ms drivers for php, which work fine (tested with normal queries). I have also tested it with running a stored procedure to update a table

how to get Arabic Month Names in sql?

I am trying hard to get the 12 months names in Arabic , I tried a lot but nothing work. any help ?

List the details of employee ,department with a reference column

Here I have 2 tables, Employee and Department, and the data as follows. Employee: Empid Empname Deptid salary ----------------------------------------- 1

Generate random int value from 3 to 6

Is it possible in Microsoft SQL Server generate random int value from Min to Max (3-9 example, 15-99 e.t.c) I know, I can generate from 0 to Max, but how to inc

VB.Net ConnectionString with a local .mdf database

I am publishing a project application and I think having a connectionstring with this format cn.ConnectionString = "Data Source=.\SQLEXPRESS;AttachDbFilename=C