Here's a few of the new posts today on the forums. To see more, visit the forums. |
SQL Server 2017 - Administration |
Grant user access to view database only - Hi I need to grant a user access to a DB on the server with read only access to view all tables and views the user is a domain user so I set them up in logins and gave them data reader only to the db what else do I need to do as when […] |
Snapshot Folder is not deleting automatically in Transactional Replication. - Hi Team, I created transnational replication to replicate the data from one server to other server.I am daily generating snapshot for some of the tables on snapshot folder.But old folders are not getting deleted from snapshot folder.. any thought? |
SQL Server 2017 - Development |
Lookup and insert into column without dynamic SQL? - Hi all, 99% sure the answer to this question is "it is not possible", but figured I'd check anyway. Suppose I have the following schema: CREATE TABLE #FieldValues ( ID INT IDENTITY PRIMARY KEY, Field1 VARCHAR(500), Field2 VARCHAR(500), Field3 VARCHAR(500) ) CREATE TABLE #FieldDefinitions ( ID INT IDENTITY PRIMARY KEY, DefinitionName VARCHAR(50), FieldName VARCHAR(50) ) […] |
SQL Server 2016 - Development and T-SQL |
Looking for tips on Optimizing - I am probably going about this the wrong way, but my current solution is by using dynamic SQL and a loop. Table creation: DECLARE @dataTable TABLE (Item VARCHAR(255), Quantity INT, WeekStart DATE) DECLARE @headerTable TABLE (Item CHAR(4), Date1 VARCHAR(25), Date2 VARCHAR(25), Date3 VARCHAR(25)) HeaderTable actually has columns Date1 through Date52. I excluded those for sake […] |
Find unmatched between 2 tables using field as selection criteria - I have the following tables as a example. Table 1 EmpID, LastName, FirstName 1,Smith,John 2,Jones,Bob 3,Citizen,Jane Table 2 EmpID,ReqID,ReqDesc 1,1,Car 1,2,Diploma 1,3,Phone 2,1,Car 2,3,Phone 3,1,Car 3,2,Diploma 3,3,Phone I want to return all records from Table 1 that don't have an entry in Table 2 that don't have a Diploma for example so ReqID = 2 […] |
Administration - SQL Server 2014 |
Do I need to install two patches for 2014 individually? - We are on version SP3/CU4 for SQL Server 2014. Since CU4, there have been two security patches released, one on 2/11/20 and the other recently on 1/12/21. If I install the latest 1/12/21 security patch, will it "include" the patch for 2/11/20, or do I need to install both of them (in sequence)? |
Development - SQL Server 2014 |
Need to strip off the beginning of a field in SELECT statement - I have this table that unfortunately has spaces in the field, which I am trimming using LTRIM(RTRIM(Field)) on. In addition, sometimes the field has "1101" at the beginning of the Field. Is there a way to remove it if it's there? Current SELECT statement: SELECT LTRIM(RTRIM(Field)) FROM myTable Example field values: 1101BRZ INSP etc. |
Save results from Stored procedure to a CSV file. - I have a SqlAgentJob calling a stored proc. that loops through a list of locations and passes the location value and other parameters to a stored procedure. I would like to save each of the results to a CSV on the server. Because i have 50+ locations my current method of a separate sqlAgenjob using […] |
Execute As not reading system view - I have a stored procedure with the following: SELECT physical_name FROM sys.master_files Where physical_name like '%' + DB_NAME() + '.%' When the procedure is compiled normally, this runs fine, but when it is compiled With Execute As 'Paleo-Server\SQLServerZaloha', this select statement returns a null. I ran this statement I found on the web: grant view […] |
SQL 2012 - General |
Aliasing an instance name for remote connections - It's been a long time since I set up a 2012 server. We have an emergency where we have to set up a new one but can't upgrade for a few months, so we're doing another 2012 and I'm having issues with the SSMS connection string. Most of our servers we can connect remotely to […] |
Do I need to install two patches for 2012 individually? - We are on version SP4 for SQL Server 2012. Since SP4, there have been two security patches released, one on 2/11/20 and the other recently on 1/12/21. If I install the latest 1/12/21 security patch, will it "include" the patch for 2/11/20, or do I need to install both of them (in sequence)? |
SQL Server 2012 - T-SQL |
Summary query for number of attendees out of all - hi all i'm trying to write a query to summarize attendance counts per department i've two tables one for event log (login/logout) transactions and the other for users details i need to show the result as dept. attend users all users dept1 5 […] |
SQL Server 2019 - Administration |
MYSQL ERROR - need desperate help - Hi, Im having a problem with new players selecting a player class. Keep getting this error. Message: Error Executing Database Query. URL: /ClassSelect.cfm? Location: C:\websites\myConvicts\www\ClassSelect.cfm Line #: 36 SQL: INSERT INTO DR_Player_Upgrade (PlayerID, UpgradeID, PurchaseDate) VALUES (2930848,27,CURRENT_TIMESTAMP) [Macromedia][SQLServer JDBC Driver][SQLServer]Violation of PRIMARY KEY constraint 'PK_DR_Player_Upgrade'. Cannot insert duplicate key in object 'dbo.DR_Player_Upgrade'. The duplicate key […] |
Reporting Services |
Search Report definitions - I know that there is a query you can run in SQL to search the SQL text procedures & objects for a specific string. Is there a way to search the report definitions of all reports for a specific string (values, table references, etc.)? |
Analysis Services |
DAX how to rewrite this FILTER to CALCULATETABLE? - Ahoi, i have been starting to look into DAX and there is something i could not find an answer to somehow. I am very new to DAX so im trying to understand the basics and have come across something bothers me. How do i rewrite the following Query using CALCULATETABLE instead of FILTER? […] |