SQL Server best export import option of selected range of records [closed]
Closed 2 days ago.
Updating data in tables linked by a foreign key
I have 2 tables:
Define constraint to prevent values outside the smalldatetime range from being inserted into a DataTable (C#)
I have a CSV file with different values. I have loaded these values into a DataTable, which has the same structure as a table in SQL, with the difference that the table in SQL has smalldatetime fields and those of the DataTable are of type DateTime. The structure of the DataTable is created dynamically according to certain user requirements.
Once the data has been loaded into the DataTable, I perform a SqlBulkCopy to copy the data from the DataTable to the table in SQL, but the process aborts (DataTable SmallDateTime overflow) because some values that exist in the DataTable are not in the range “1/1/ 1900 12:00:00 AM and 6/6/2079 11:59:59 PM”
C++ MSSQL query returns string like “MMMMMMMMMMMMMMMMMMMMMMMMM” if field in DB is NULL
I am creating a c++ program to work with a mssql database. I connect to the base with the code described in this video https://www.youtube.com/watch?v=1g_Xng_uH2w&t=835s. However, I encountered one problem. When the database field is NULL in the query response I get one big string of something that looks like “MMMMMMMMMMMMMMMMMMMMMM”. Can anyone tell me how I can change this. The best option is for my request to return NULL.
Executing stored procedure from C# fails with linked server but works in SSMS
We are using C# to execute a stored procedure where this stored procedure uses EXECUTE AS
to call data from a linked server.
How can I stop one instance of SQL Server 2019 Express LocalDB?
I am developing a Windows program, using C# and VS 2022. This program is linked to a .mdf
database file, and everything works fine in development.
How can I stop one instance of SQL Server Express LocalDB 2019?
I am developing a Windows program, using C# and VS 2022. This program is linked to an .mdf database and everything works fine in development.
I got an error when running query using C#
enter image description here
how to deal with sql server connection pooling leaking transaction isolation levels
When you are using Microsoft SQL Server connection pooling, a recycled connection gets all the session details reset (eg: temp tables are deleted). Internally this is done by the special sproc sp_reset_connection. This answer has a full list of details which are reset – What does sp_reset_connection do . One notable thing which is not on this list is the transaction isolation level. So, for example, if a connection has run a transaction at the read uncommitted level, and that connection gets recycled, the next thread which receives that connection will have a transaction isolation level of read uncommitted, which is different from the default on brand new connections of read committed. This behavior is intended (by Microsoft), as it’s documented in the TDS spec; there’s this sentence in there “Distributed
transactions and isolation levels will not be reset.“.
Cannot Publish to MSSQLLocalDB
For starters, I am a complete novice with data access, and am working through the iamtimcorey C# Mastercourse (meaning this is the complete extent of my knowledge of SQL Server and data access in general).