|
|
|
|
|
|
|
|
Question of the Day |
Today's question (by Carlo Romagnano): | |
How many columns? | |
How many columns does this SELECT return?
DECLARE @x XML = ' EVEN ' ,@y XML = ' ODD ' SELECT Seconds = DATEPART(SECOND,GETDATE()) ,Parity = CASE WHEN DATEPART(SECOND,GETDATE()) % 2=0 THEN @x ELSE @y END .value('(//T)[1]','varchar(100)') | |
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) |
Fully Indexing Views I have an indexed view created in my SQL Server 2019 database. Can I create a full-text index on this view? Answer: Yes Explanation: You can create a full-text index on an indexed view. Ref: CREATE FULLTEXT INDEX - https://docs.microsoft.com/en-us/sql/t-sql/statements/create-fulltext-index-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 - Development |
Collaborative online projects - I am interested in joining an online project effort. Where is a good place to look? |
SQL Server 2016 - Administration |
Rewriting Query for performance - Hello, I'm trying to test and rewrite an SP PROC ( to reduce run time if possible) using temp table and insert data from a very big table and has couple of joins to other tables to get desired data .. here are some questions 1# how can I ensure my join order is correct. […] |
why am i seeing SQLTRACE_FILE_READ_IO_COMPLETION in top waits? - why am i seeing SQLTRACE_FILE_READ_IO_COMPLETION wait in top 5 waits all the time? What is it, and should or can it be reduced/turned off? |
SQL Server 2016 - Development and T-SQL |
sql query help - hello everyone, i have a query with respect to pivot. As per my understanding pivot is used to transpose rows to columns. however as i was going through the documents and examples, the pivot works with a aggregate value. what if i don't want to do any aggregate ? what if there's any varchar value […] |
Loading Data To Normalized Tables - Something I've always wondered is how is data loaded in a normalized OLTP database? One example that I think about is an ATM transaction because it captures data ranging from customer to ATM location. If the database is designed in at least 3NF then it would have multiple tables related to customer to handle name, […] |
Development - SQL Server 2014 |
UPDATE all or only changed values - UPDATE MyTable SET Num = 999 UPDATE MyTable SET Num = 999 WHERE Num <> 999 --ignoring nulls issue for now If a large table in production, I do the second. So treating an UPDATE as changing values only. Though no doubt there are situations where collecting information on overwrites would be important. I've assumed […] |
Simple trigger for auditing - I'm after a simple trigger to audit inserts and deletes on a single table. If the PK does not exist in the audit table (i.e. an INSERT has occurred) then insert into the audit table. If the PK exists in the audit table (i.e. an UPDATE has occurred) then insert into the audit table the […] |
SQL Server 2012 - T-SQL |
Compare columns within the same row - I have the following row: And, I need to compare the Amts to only pull back the Reason for the largest Amt Value. In the example above Amt2 has the largest values, so I would need to SELECT only Amt2Reason of YY-This2. I have been at this a few hours now and nothing is […] |
SQL Server 2019 - Administration |
Restored database with encrypted data - I have a database which contains a table with encrypted data. I have restored this database onto a new instance (and upgraded from SQL2016 to SQL2019) but now, when I try to access the encrypted information, I get the error: Msg 50000, Level 16, State 1, Procedure [database].[schema].[procedure], Line 27 [Batch Start Line 7] Please […] |
SQL Server 2019 - Development |
Create a matrix view from a table - Hi, I have a table called facility: id name 123 Hospital blah blah 124 Dr's office 1 125 Dr's Office 2 126 Hospital 2 It joins on a table called patient patient_id facitility_id 1234 124 1234 236 2345 236 2345 124 […] |
Issue with the the new Microsoft managed Oracle data source component for SSIS - During preparation for a large SSIS upgrade project from SSIS 2012 to SSIS 2019 we have identified an issue with the new Microsoft managed Oracle data source component for SSIS 2019. This component replaces the Attunity component used in earlier versions of SSIS. If you are fortunate the upgraded SSIS packages will simply fail but […] |
Selecting data from one table and multiple counts from another - I have a table called AgentGroups which just has two columns, GroupID and GroupName. I then have two other tables AgentGroupMapping and SkillGroupMapping that both also have a GroupID column. I want to select all of the rows from the AgentGroups table and then the count from both of the other tables where the GroupID […] |
SQL Server Newbies |
Using Results from CASE Statement to create a calculated Field - Hey all, Sorry for asking so many questions, but I'm usually not able to easily find solutions to the problems I face. This particular problem is as such. I have a numerical column and a string. If the string matches a condition, I want to make it negative and then add with another column. Let's […] |
Unable to append strings to record from SELECT Statement - Hi All, Just had another newbie question, I practiced some sql commands on the w3 schools sandbox, basically my goal is to take all records from a column and append a string before each record. So in the W3 SQL Sandbox, https://www.w3schools.com/sql/trysql.asp?filename=trysql_asc I can type in the query SELECT 'A1-' || CustomerID FROM Customers […] |
Integration Services |
How can I execute OLEDB Command without Result Set - I am working with an application that has many INSERT and UPDATE stored procedures for our tables. I am migrating data from one version of our system to another version using a formatted text file. The text file has columns that I can map to the parameters of a stored procedure using an OLEDB Command. […] |
| |
©2019 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved. webmaster@sqlservercentral.com |