|
|
|
|
|
|
|
Question of the Day |
Today's question (by Steve Jones - SSC Editor): | |
The R function scope | |
I have this function in R.
f <- function(i) { g <- function(j){ j+k } k <- 4 i * g(i) }I then run this code: > k <- 10 > f(4)What is returned? | |
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) |
The CURRENT_TIMESTAMP I have a CREATE TABLE statement and I use a default for a column with the CURRENT_TIMESTAMP value. My table looks like this: CREATE TABLE defaulttest2 ( myid INT , mydate DATETIME2(7) DEFAULT CURRENT_TIMESTAMP) GO What is the datatype that is returned by CURRENT_TIMESTAMP? Answer: datetime Explanation: CURRENT_TIMESTAMP returns a datetime data type, without time zone data. Ref: CURRENT_TIMESTAMP - https://docs.microsoft.com/en-us/sql/t-sql/functions/current-timestamp-transact-sql?view=sql-server-ver15 |
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 |
Business Use changes - when to delete disabled jobs - Over the past 5 years with my employer, I have created a number of stored procedures, jobs, etc as I built interfaces for outside vendors. As the vendors have changed, and we entered into an affiliation agreement with a larger organization, many of the jobs are now disabled and the tables and SPs are no […] |
SQL Server 2017 - Development |
Seeking input on Best Method to Join on First or Last Row in a 1:M Join - I have included the DDL to re-create the 2 tables in this examples. I can't post the actual DDL so these are abbreviated versions of the 2 tables I'm working with. The relationship between PERSON and PERSON_HISTORY is 1:M. What I seek is the most effective/best method for joining these 2 where I get only […] |
SQL Server query results sort order with totals - I am trying to sort by the ID with the highest total. I can sort by ID and then get the total for each member but I cannot seem to get it to sort by id and total. Below is what I have and what I want. On what I have I am doing Any suggestions on […] |
SQL Server 2016 - Administration |
Argument syntax for SSIS Execute Process Task Editor - Hi, I'm trying to modify my SSIS packages to use sftp and since it cannot be done using the FTP Manager Connection within SSIS, I am calling a PowerShell script to connect to our sftp server and move the files as needed. The PowerShell script works okay and copies the file with no errors, but […] |
Handling reports of slow-running procedures - Hello experts, Does anyone know of a page or document that outlines a process for user reports of "slow-running procedures"? This issue is pretty frustrating for me because SQL activity is so dynamic that it's not like easier problems of missing permissions, low drive space, etc. Each time I get a request to look into […] |
SQL Server 2016 - Development and T-SQL |
Multiple deadlocks occuring on simultaneous deletions from temporal table - We have a stored procedure which is attempting to delete 1-2 rows at a time from a temporal table overnight. The stored procedure is executed several times simultaneously (around 10-15 threads) by parallel processes, and so attempts may be made to delete 30 rows simultaneously by different SPIDs, for example. DELETE FROM dbo.Table WHERE ID […] |
Does Every BEGIN require an END - Does every instance of BEGIN within your code require an END? I've seen more than one piece of code, usually a Stored procedure made by the vendor who provides our accounting software, that has more instances of BEGIN than END. I always believed that every instance of BEGIN required an END. Is that not the […] |
help on execute table variable into one table - I have created table variable as below , just want to that result into table as last line is not working please help on that, Select * into table_temp from execute (@query) how to make sure this query like select * into table_2 from table_1 DECLARE @cols AS NVARCHAR(MAX), @query AS NVARCHAR(MAX) select @cols […] |
SQL Server 2019 - Administration |
UniqueIdentifier as Primary Key, non-clustered index, fragmentation issue - I've been working a little bit with a few tables here, they've got "CreatedDate" as clustered Index and and Id (UniqueIdentifier) as Primary Key. The Id's are generated from code and are non-sequential. The problem(?) is that the Id-PK index gets heavily fragmented almost instantly even after a defrag-session. I can't say I've identified any […] |
SQL Server 2019 - Development |
DB logins permission script out - Hi, Can anyone share or point me to get -DB logins permissions in a single script. Not using use dbname. I could see all script is having use db, since i have lot of db. |
Unable to connect to Remote SQL Server Application from C# Application - Hi there We have a remote SQL Server instance on a VM , that we can connect to successfully from SQL Server Management Studio on my local machine. However I am having problems connecting to this database from a c# application Now my connection string is as follows: string ConnectionString = "server=METRODEMO\\SQLEXPRESS;Database=Logger;Trusted_Connection=True;"; I have also […] |
SQL Server 2008 - General |
Foreign key for Xml Datatype - Is foreign key constraint possible in xml data type? OR Is it possible to mention multiple Foreign keys in a single cell? For ex: If xml has 2 rows, 2 ids will be given in main col with some separator, if xml has 3 rows then 3 keys so on. Can it be done? |
Checkdb error - While executing DBCC CHECKDB i am getting following error "Check terminated. A failure was detected while collecting facts. Possibly tempdb". Checked for estimated tempdb following was the result. Estimated TEMPDB space needed for CHECKALLOC (KB) 19762 Estimated TEMPDB space needed for CHECKTABLES (KB) 1 Auto growth is enabled for tempdb still error repeats. what is […] |
Powershell |
table script to dump to csv with foreign key order - Can PS be used to dump the SQL DDL to csv but do it in the order which would used to reload an empty database.. Tables have lots of foreign key constraints . I would like to produce a file that I could use to rebuild an empty database, but foreign keys are causing me […] |
Oracle |
Need Help with Pivot / Unpivot SQL - Hi Can any one help me with query to transfer from position1 to position2 as shown below ? |
| |
©2019 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved. webmaster@sqlservercentral.com |