Laden...
|
|
|
|
|
|
Question of the Day |
Today's question (by Steve Jones - SSC Editor): | |
Using Heaps | |
When does Microsoft recommend using a heap as a table structure (no clustered index)? | |
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) |
Adding Defaults I have a table, called dbo.logger, in SQL Server 2022. I decide to add two new columns to this table with this code. ALTER TABLE dbo.logger ADD CreateDate DATETIME CONSTRAINT dfGetDate DEFAULT GETDATE() GO ALTER TABLE dbo.logger ADD ModifyDate DATETIME DEFAULT dfGetDate GOWhat happens when I run these two batches? Answer: The first executes, but the second returns an error Explanation: In this case, the first statement executes successfully and creates a new default constraint on the table. The second, however, fails, as the constraint names must be unique. Ref: Specifying default values for columns - https://learn.microsoft.com/en-us/sql/relational-databases/tables/specify-default-values-for-columns?view=sql-server-ver16#use-transact-sql-to-specify-a-default |
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 - Development and T-SQL |
Getting year part out of a string that represents a date - Hi, I have a requirement to fetch the year from an imported .csv file that can hold any kind of date , in any format as delivered to use by municipalities that manage to get their own ideas of the template they need to use. Basically the date can have many formats , like YYYY-MM-DD […] |
Dropping a PK constraint. - I will have to test this next week, but will not have a chance before Friday. My question is, if I backup table data, drop a PK to add it back as an identity PK, will the foreign keys referencing the PK still be in tact? The new PK (now with identity) will keep the […] |
SQL Server 2019 - Administration |
disable remote access - If I configure remote access to 0 on my servers, am I right in saying that the only things that would be affected are any linked servers && log shipping jobs. Thank you. |
Creating Maintenance plan to run annually - What is the best way to set the schedule of a maintenance plan or a SQL Agent job to run annually. We need to move data to an archive database for a table end of each year for the oldest year. I have the scripts all ready but the scheduling is the issue. For this […] |
SQL Server 2019 - Development |
Is there a way to implement ROWS between logic? - Hi everyone SUM function has the option to select ROWS BETWEEN parameter to allow for a rolling sum calculation. This is very useful. I would like to do the same for PERCENT_RANK but this function does not have this option available. Suppose there are 100 daily records and I want to calculate the PERCENT_RANK on […] |
skipping the second line in a spreadsheet being read by ssis - hi, my new user provided a new multi tab (sales, customer etc. not what i really wanted either) excel spreadsheet for ingestion by our sales warehouse etl. Its second line is his erp's column names. The first line is somewhat close to what i asked for in column names. for the moment im looking the […] |
Editorials |
Multiple Monitoring Tools - Comments posted to this topic are about the item Multiple Monitoring Tools |
SQL Server 2025 Excitement - Comments posted to this topic are about the item SQL Server 2025 Excitement |
Patching the Patch - Comments posted to this topic are about the item Patching the Patch |
Events |
Crosstabs and Pre-Aggregations - Reporting on Steroids by Jeff Moden - The LA Data Platform User Group had a necessary speaker cancellation for the group meeting on 18 June 2025. They fired a flare asking for a replacement speaker and I responded. And so I'm giving the presentation that's in the title of this post. I had to limit the size of the abstract and so […] |
Article Discussions by Author |
How to Choose the Right Tool for MS SQL to PostgreSQL Migration - Comments posted to this topic are about the item How to Choose the Right Tool for MS SQL to PostgreSQL Migration |
Inside the Walls of Azure SQL MI - Comments posted to this topic are about the item Inside the Walls of Azure SQL MI |
SQL Server 2022 - Development |
XML_COMPRESSION for existing tables - We are in the process of upgrading to SQL Server 2022 and would like to make use of the XML compression feature it offers, as we have a handful of tables that store considerable amounts of XML data. I suspect the answer is "no", but is there a way to enable XML compression on an […] |
SQL - Conditional merge join - I want to add a condition in the joining columns part of the merge statement like this : Merge dbo.tblDest as target using (select ...) as source on target.EmpID = source.EmpID and target.AwardID = source.AwardID --this second condition I want to add only if the source.AwardID is not null. How to do that pls advise. […] |
Tracking changing prices and recalculating inventory value - I'm trying to figure out a how to do average costing over time in T-SQL... I'll use up ingredient inventory over time, and every six weeks buy more. So the "leftover" ingredients would be valued at [Weight Remaining] * [Per Kg Price]. Then when I buy new inventory, the new total value would be [Weight […] |
| |
©2019 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved. [email protected] |
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Laden...
Laden...