Here's a few of the new posts today on the forums. To see more, visit the forums. |
SQL Server 2017 - Development |
Query - ServerName DatabaseName DatabaseSize(MB) Date Server DBName Size Date A DB 110 6/1/2023 A DB 113 7/1/2023 A DB 118 8/1/2023 A DB 130 9/1/2023 A DB 120 10/1/2023 A DB 140 11/1/2023 A DB 143 12/1/2023 A DB2 1110 6/1/2023 A DB2 1113 7/1/2023 A DB2 1118 8/1/2023 A DB2 1130 9/1/2023 A DB2 1120 […] |
SQL Server 2016 - Development and T-SQL |
send csv file or txt file to sftp server - Hello Can someone help me with code to send file to sftp server please: Here is my code: # SQL Server query $Query = "SELECT name from tblName" $SqlConnection = New-Object System.Data.SqlClient.SqlConnection $SqlConnection.ConnectionString = "Server=CWR-PP02;Database=testdb;Integrated Security=True" $SqlCmd = New-Object System.Data.SqlClient.SqlCommand $SqlCmd.CommandText = $Query $SqlCmd.Connection = $SqlConnection $SqlAdapter = New-Object System.Data.SqlClient.SqlDataAdapter $SqlAdapter.SelectCommand = $SqlCmd $DataSet = […] |
SQL Server 2019 - Development |
Improving Code Readability - Below is a code i wanted to improve some readability and functionality: GO /****** Object: View [Prod]. SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER VIEW [Prod]. AS --------------------------------------------------------------------------------------------------------------------------------------------------------- SELECT MAN_ADJ_ALL.[FY] ,MAN_ADJ_ALL.[Period] ,MAN_ADJ_ALL.[Group] --ADJUST THIRD PARTY TO ALLOCATED PLANT ,CASE WHEN MAN_ADJ_ALL.[Cost Element] LIKE 'Variable 3rdP Cycle1' THEN MAN_ADJ_3RDPARTY.[Plant] ELSE MAN_ADJ_ALL.[Plant] END AS [Plant] […] |
Selecting from a view, base table has a DENY on a column - This is something I've never seen before and I can't think of the right way to search properly for this, so I'd like to throw it out to this group. We have an audit table that stores the old password value when someone changes it. There is a DENY on this column for all but […] |
JSON data with Pivoted - Hi All, I need some assistance and not sure how to achieve the expected output. I have a JSON input parameter which is a nvarchar(max) passed from my application as per my sample code below. I've started to break up the JSON into a table output and am a bit stuck on getting how I […] |
SQL Server 2008 - General |
Merge Replication SQL 2008 (10.0.6556) - downloads slow and behind - Merge Replication SQL 2008 (10.0.6556) - downloads slow and behind I am working on newly virtualized sql cluster with sql 2008 and merge replication with replication of many tables on a large database (multiple TB data file). Recently, the merge replication of one of two pubs for it started to appear to only perform uploads […] |
Azure Data Lake |
Lake Database Performance Optimization - I recently created a synapse link for Dataverse. The resultant Lake Database in Synapse is powering a number of Power BI reports, however the performance of the lake database is a slower than we had expected. What steps can I implement to improve the performance of the lake database? |
Analysis Services |
Calculated Time Periods Hierarchy - Please help me understand why I am getting the following error: "A set has been detected that can't contain calculated members." I have Attributes "Dates" and Hierarchies "Calendar" (YearID/QuarterId/MonthId/dtDate). I've created Calculated Member a "Current Month" for the parent hierarchy «Dates.Calendar.[all]». CREATE MEMBER CURRENTCUBE.[Dates].[Calendar].[All].[Current Month] AS StrToMember("[Dates].[Calendar].[Month Id].&[" + Format(now(), "yyyyMM") + "]"), VISIBLE = […] |
Calculated Time Periods Hierarchy - please help me figure out why I'm getting the following error: "A set has been encountered that cannot contain calculated members." I have Attributes "Dates" and Hierarchies "Calendar" (YearID/QuarterId/MonthId/dtDate) I created Calculater Member "Current Month" for Parent hierarchy "Dates.Calendar.[all]" CREATE MEMBER CURRENTCUBE.[Dates].[Calendar].[All].[Current Month] AS StrToMember("[Dates].[Calendar].[Month Id].&[" + Format(now(), "yyyyMM") + "]"), VISIBLE = 1 […] |
Relationship between dimension and measures - There is a Fact Table (.....,MenuID, MOption, CallTime) There is also a Dimension "Menu" Table (MenuId,OptionID) Relationship between these tables (MenuID and MOption) In the Dimension table, I created another field - keyField (string(MenuID+MOption) as OptionId2) when creating Dimension, I use the new key (OptionId2) and build the hierarchy accordingly -MenuId -OptionId2 (ключ) but […] |
SQL Server 2022 - Administration |
Moving database servers - IP address change - listeners - Hi, We will be moving our physical database servers to a new location. Prior to the move, new IP address for all the SQL servers will be changed/updated. Are the IP address listed above for the cluster server? After the servers are moved will I need to change the IP address for the […] |
how to install smo in an offline machine - hi, how do I install smo in a offline machine https://www.nuget.org/packages/Microsoft.SqlServer.SqlManagementObjects#usedby-body-tab Install-Package Microsoft.SqlServer.SqlManagementObjects -Version 170.18.0 PS C:\Users\Administrator> Find-Module -Repository smo WARNING: The file extension 'C:\Packages\nuget.exe' is not valid. The required file extension is '.nupkg'. Version Name Repository Description ------- ---- ---------- ----------- 21.0.17224 SqlServer SMO This module allows SQL Server developers, admin […] |
SQL Server 2022 - Development |
Retrieving First Word, First + Second Word, First + Second + Third Word, First - Hi All, I have the company names in one column. Need a sql server query to fetch in separate column like Example: ABC private limited company First Word ABC First + Second Word ABC private First + Second + Third Word ABC private limited First + Second + Third + Fourth Word ABC private limited […] |
Why don't these two queries return the same data? - I have a table-value function that returns data for a report. However, it's not returning the correct data, so I've reworked it and it's now returning what I'd expect ... the thing is, to my obviously unseeing eyes the two queries should be functionally identical. Please can someone help? This query doesn't work: SELECT Grades.[Name] […] |
SQL Challenge: Employee Salary Analytics - onsider an employees table: employee_id (int) employee_name (varchar) department (varchar) joining_date (date) salary (decimal) Highest Earner by Department: Find the employee with the highest salary in each department. Average Salary by Department and Year: Calculate the average salary for each department per year. Longest Serving Employee: Identify the employee with the longest tenure. Please provide […] |