Laden...
|
|
|
|
|
|
|
Question of the Day |
Today's question (by Steve Jones - SSC Editor): | |
DCL | |
We have DDL, DML, and DCL. What is DCL used for? | |
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) |
Function Defaults I have created this function in SQL Server 2022: CREATE FUNCTION dbo.AddInt (@one INT, @two INT = 1) RETURNS INT AS BEGIN RETURN @one + @two ENDHow can I call this and invoke the default value for @two? Answer: SELECT dbo.AddInt(4, default) Explanation: You must provide all the parameters for a function, but if you know there are defaults, you can use the DEFAULT (or default) keyword. Ref: CREATE FUNCTION - https://learn.microsoft.com/en-us/sql/t-sql/statements/create-function-transact-sql?view=sql-server-ver16#syntax (see the parameters section) |
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 2016 - Administration |
Query is filling Tempdb - I have query which is filling TEMPDB I need suggestion how to modify this query to which can minimize the TEMPDB space to fill update #TempShow1 set Name = case when a2.ID is NULL then a1.name else a2.name end, Address = case when a2.ID is NULL then a1.Address else a2.Address end, State = case when […] |
SQL Server 2016 - Development and T-SQL |
Script is filling Tempdb - I have query which is filling TEMPDB I need suggestion how to modify this query to which can minimize the TEMPDB space to fill update #TempShow1 set Name = case when a2.ID is NULL then a1.name else a2.name end, Address = case when a2.ID is NULL then a1.Address else a2.Address end, State = case when […] |
SQL Server 2012 - T-SQL |
Group records during capture - I have a table which is being written to by another application. A few things of note I can't alter schema, or unable to upgrade the sql version at this time. I need some help in a couple of areas. The first is to grab the last 15 minutes of information from this table. The […] |
SQL Server 2019 - Administration |
Filter a SQL Server Audit with a predicate - Hi Gents, Silly question, but it's been a long time since I've done this. I need an audit of all successful and failed login attempts, so I created an Audit, but I don't want to log everything, so I added a filter: WHERE ([action_id]=(538990668)) based on https://techcommunity.microsoft.com/blog/sqlserver/filter-sql-server-audit-on-action-id--class-type-predicate/384140 SELECT [class_type] FROM sys.dm_audit_class_type_map WHERE [class_type_desc] = 'LOGIN'; SELECT […] |
Copy a large table from one table to another - Hi, I have large table with 75 columns and 1.1 billion rows. Want to know the fastest way to copy from one table(non partitioned) to another(partitioned) table. Did anyone tried this. If yes, how long it took to load the data. I tried SSIS package with multiple threads, select- insert in batches and OPTION MAXDOP. […] |
SQL Server 2019 - Development |
how to generalize the LAG function so it keeps looking until a value is found? - Hi everyone There are situations where a value for a particular day is NULL so I use the previous day's value hoping it isn't NULL. I use LAG for this. The problem is that sometimes even the previous value is NULL so I have to use LAG(2) to get the 2nd previous value. This approach […] |
How to speed up this query? - Hi everyone I have a query that is taking a real long time. It takes close to 30 minutes to process about 14 million records. Is there any way to speed it up? Query: DROP TABLE IF EXISTS #TestTable DROP TABLE IF EXISTS #TEMP1 CREATE TABLE #TestTable ( [UNIT] [nvarchar](10) NOT NULL, [PURCHASE_DATE] [date] NOT […] |
Testing |
Understanding allowed topics for testing - Hi, I am a first time writer looking to author some content here. I am in the software testing industry. Are we allowed to submit content that is not related to SQL or databases or should they all be related to databases? Thanks, Arun |
Analysis Services |
Issue with IIF - I am creating a new measure in an SSAS cube and encountering an issue. The result is being displayed in an Excel pivot table sourced from the cube. Here’s the code I’m working with: MDX CREATE MEMBER CURRENTCUBE.[Measures].[New Column] AS IIF( [Date].[Month Of Year].[1] OR [Date].[Month Of Year].[2] OR [Date].[Month Of Year].[3], -- Logical condition […] |
Integration Services |
Date data type not recognized with oledb type provider - Hello, We recently made the following observation working with VS2022 combined with the SSIS extension 'SQL Server Integration Services Projects 2022 (version 1.5) When creating a connection manager the driver of choice is set to SQLOLEDB.1 With these type of connection string the SQL datatype 'date' is not recognized and set to WSTR(10) , be […] |
Suggestions |
Peer review SQL Central articles - Hi, I would like to contribute to SQLServerCentral in peer reviews. As there are many articles that need to be reviewed on a daily basis, i assume this site needs some reviewers. May i know the process to become reviewer and start contributing.? |
SQLServerCentral.com Website Issues |
Topic marked as spam - by mistake? - I received the following notification a few hours ago. It seems legit but has been marked as spam – should it be resurrected? harrylune wrote: Do you have any advice on how to set up git repositories for the things indicated in the title? I'm particularly interested in hearing from anyone who have experience with […] |
Third Party Products |
ESP Scheduling Tool - Has anyone ever used Broadcom's ESP Scheduling tool? I have questions regarding it and the use of password-protected SSIS packages if anyone can help. |
SQL Server 2022 - Development |
Getting blockage on Update Statement - Hi, Need your help. I've a SP that is using Update statement on a table. 2-3 processes are updating this table at the same time. I'm getting frequent blockage. How can we handle to prevent blockage? Will using SET XACT_ABORT ON can help? Or setting to isolation level can help? SET TRANSACTION ISOLATION LEVEL READ […] |
Which selection criteria is more efficient. - Is it more efficient to search on an int than a nullable DateTime? I have a table where I can choose to search on an int field in the where clause or a nullable datetime field looking for nulls in the where clause. Both methods return the same resultset. While I am most likely nitpicking, […] |
| |
©2019 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved. [email protected] |
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Laden...
Laden...