|
|
|
|
|
|
|
Question of the Day |
Today's question (by Steve Jones - SSC Editor): | |
The PowerShell Array Removal | |
I have this code in PowerShell:
$numbers = @(1,2,3,4,5,6,7,8,9,10)I run this code. How many rows are returned? $numbers[4]=$null $numbers | |
Think you know the answer? Click here, and find out if you are right. |
Yesterday's Question of the Day (by Steve Jones - SSC Editor) |
Parameter Defaults I have a T-SQL stored procedure that looks like this: CREATE PROCEDURE dbo.AddTogether @a int , @b int = 1 AS BEGIN -- Declare a variable to store the result DECLARE @result INT; -- Add the two parameters and assign to the variable SET @result = @a + @b; -- Return the result SELECT @result; END; Where can I query the DMVs to get the parameter defaults? (null for @a, 1 for @b) Answer: Only from the stored procedure code in sys.modules Explanation: The default values for parameters are not stored anywhere in the DMVs. These are only in the object code definition, which is easily gotten from sys.sql_modules. Ref:
|
Database Pros Who Need Your Help |
Here's a few of the new posts today on the forums. To see more, visit the forums. |
SQL Server 2017 - Administration |
Arctic Wolf flooding SQL error log - Hello experts, I am not sure if anyone uses Arctic Wolf for a security tool, but we recently implemented it and one thing it does is penetration testing and vulnerability scanning on our SQL Servers. Our IT team has this turned this feature on as they want to make sure things are secure, but it […] |
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 - Administration |
emergency!!! RecoveryPending how to fix it? - How to fix Recovery Pending State in SQL Server Database,please help |
SQL Server 2016 - Development and T-SQL |
housekeeping of millions of records on everyday basis - Hello!! We are building our system that will be up and running for 24x7 365 days. the data will be generated in millions each day. Kindly help with the best practices material where in we can implement smooth house keeping processes on each table so as to not to load the tables as well as […] |
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 |
Validation of special char and replace for the good one - Hello I need help on how to do this more efficient. I will need to write a store procedure to validate an address which contains special characters Address is like : Street : Las Ñipas 4264 So i need to remove the Ñ and replace it for N I was reading to use collate SQL_Latin1_General_CP1253_CI_AI […] |
Query to get the previous row from the row selected - Hi I have payroll detail table in which I have payroll details id and an employee id (foreign key from employee table). My requirement is, when a row is selected for a particular employee, I want to get the value from a the previous row. For example if I have 3 employees and each have […] |
How to write to a file from SQL Server running on Docker Container on Linux - So we have a SQL Server database running in a Docker Container on Linux There is a stored procedure which will take in JSON as a parameter and extracts data out into a table called dbo.BCPOutput Now I can run this from SQL Server Management Studio (in SQLCMD mode) :connect 217CAS -U sa -P xxxxxxx […] |
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 […] |
SSRS 2012 |
SSRS Open link in new tab - Hello! I have a report that lists all reports in folders on the report server, if you click on the report name I want it to open a new tab with that report. So I am not sure where I am going wrong. I am building my URL link to other reports on the server […] |
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: I need to create Calculated Member for "yesterday", "current month", "current year", but but I keep getting an error message 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 […] |
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 |
Replication for archive server with longer retention period - I want to set up SQL Server transactional replication from a main SQL Server to an archive SQL Server. The archive will contain historical data and have a retention period much longer than the main server. Data will be purged by application code on both the main and archive servers, and the archive will be […] |
| |
©2019 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved. webmaster@sqlservercentral.com |