Here's a few of the new posts today on the forums. To see more, visit the forums. |
SQL Server 2016 - Administration |
Shrink database issue - In my database, I have few temp tables that total up to 50GB in size. I already removed the data from the table. When I set the shrinkdatabase in my maintenance plan, it runs successfully but doesn't shrink the database. I tried dbcc shrinkfile(1,truncateonly) and got the same result. However, from sql management studio when […] |
TCP Provider: A connection attempt failed for target server - Hi. In source SQL Instance target linked server has been created and connection tested succeeded. but while executing stored procedure execution failed as below errors. how to fix this issues? checked it is enabled at target instance allow remote connection. TCP Provider: A connection attempt failed because the connected party did not properly respond after […] |
SQL Server 2016 - Development and T-SQL |
How to copy XML converted data to file on local drive? - Hi everyone, So I have been working on converting my SQL tables data into XML files. I have designed a query that looks like this: --START OF TABLE List SELECT ( SELECT --(SELECT COALESCE (List_ID,'')) AS List_ID, (SELECT COALESCE (List_Type,'')) AS List_Type, --(SELECT COALESCE (List_Description,'')) AS List_Description, --(SELECT COALESCE (List_Provider,'')) AS List_Provider, --(SELECT COALESCE (Issuing_Body,'')) […] |
How to calculate orders historically, during month - Good Morning There, CREATE TABLE Customers ( CID int NOT NULL PRIMARY KEY, GroupName varchar(255) NOT NULL, FirstName varchar(255), Age int, CustomerStatus SMALLINT, ---1 Means Active, 0 Inactive CustomerJoinDate Date ) CREATE TABLE Customers_Orders ( CID int NOT NULL PRIMARY KEY, Day_Date Date, ORDER_INDICATOR SMALLINT, --- 1 means made order 0 means no order Account_CashDeposit […] |
Insert data into multiple tables after each batch of 100000 rows - Hello! I have a table with 2 million rows. I need to insert data into new table for each batch of 100000 rows. Thanks in advance. |
SQL Server 2012 - T-SQL |
table design for user "matching" - I am finding users that have liked each other. I have a user table and matched table: create table matched (match_id int identity not null primary key ,user_id char(1) ,interested_in_user_id char(1) ,interested_by_user_id char(1) ,mutual_yn char(1) ); insert into matched values('A','C',null,'N'), ('A','D',null,'N'), ('C','B',null,'N'), ('C','A',null,'N'); select * from matched; query results: When a record is inserted […] |
SQL Server 2019 - Development |
Migration of simple SPs from 120 to 150 COMPATIBILITY_LEVEL issue. - Migration of simple SPs from 120 to 150 COMPATIBILITY_LEVEL issue. Execution time for the first time run of any SP is close to 3 min. After the first execution, it takes ms to repeated execution. The execution plan is identical in 120 and 150. Recompile did not help. SPs are sitting on wait: PAGEIOLATCH_SH for […] |
Referencing a SQLCMD variable in a Post Deployment script using SqlPackage - Ive got a Database project running in JetBrains Rider. The project publishes a DACPAC to create or update a target database. Now I have a set of reference data scripts which run (in Create mode) and these are reference through the Script.PostDeployment which looks like this: :r .\LoadDeviceConnectionType.sql :r .\LoadUser.sql :r .\LoadConversionType.sql :r .\LoadChannelType.sql :r […] |
Calling stored procedure to bulk import from SSIS causes access denied - Hi, I'm working on building a data validation engine, which is supposed to check a number of items, such as existence of fields in CSV files before they are imported by SSIS. This is done with the bulk import command via a stored procedure. What I'm trying to do is the following [SSIS] Gather filenames […] |
undocumented syntax? - I recently saw this syntax used in an example - SELECT INTO FROM (SELECT 'Literal') AS EX(); Now I have figured out what it accomplishes but I have yet to find any documentation for the EX() syntax. Can anyone point me to it or is this an undocumented feature? |
Missing weekend data to Zero - Hi All, I have a requirement that if there is no weekend data then i should mark the next row with zero. Here for 123 , A there is no sales received for week 4 and so we need to make it to zero. and the same for 123,B there is no sales for week […] |
Save Query Results to Excel and Automatically run it - Hello, I have a very simple query Select * from Employees where company = 'Company A' order by firstName I want to run this query to run automatically on a daily basis and save the results in excel. Is their any way I can achieve this purpose? I tried using SQL server jobs […] |
BlobColumn to String - I have this column in sql server that has value of "dog,cat,mouse" so I want to fetch this data into SSIS then transform it into an array using script so I can loop through it but I'm having an error when doing so. var columnfromDB = "1,2,3"; // Need population so that Split won't throw […] |
SSRS 2014 |
Get Part number and display in Header - Hello, so I have a part number, and I want to display it in the header, however I do see it available as "FIRST" meaning it will only display the FIRST part, however this particular report, the user has a chance to select Multiple parts, so the report is grouped by parts to show the […] |
General |
How and where did you learn SQL from? - Could you give me advice on where I should learn SQL and Python to become high-skill engineer? Most tutorials and courses seem here to focus on the querying part of SQL. But I want to learn how to design, structure and create Data and databases. |