Run sqlcmd on sql server from a different non-sql server machine
I have two servers, A and B. "A" has sql server installed and running on it."B" does not have sql server installed on it.I need to run a cmd script on server B which that will execute a stored...
View ArticleDATE CALC: Operand type clash: date is incompatible with int
Okay, so I'm stumped. Why does my code keep erroring out? What am I missing here in my WHERE clause? My desired results is to return only the last record of the table. -----------------------------...
View ArticleReplace 0 with Null
i want to replace null with zerodeclare @fromdate date='2020-01-15' declare @todate date='2020-01-15' declare @columns varchar(max) declare @convert varchar(max) select @columns = stuff (( select...
View ArticleHow to update status with wrong length where length after $ not equal length...
problemHow to update status with wrong length where length after $ on Signature Key not equal length of portion Key depend on groupid ?I work on SQL server 2012 I face Issue I can't Update Status with...
View ArticleMasking Numeric with spaecial charater
The Data looks like.12345678987654345117568792311134how can i replace first 3 and last 3 numbers with xExpected output:xxx456xxxxxx5434xxxxxx8792311xxxThanks a lot
View ArticleUpdating a uniqueidenfier column
Hi everyone, I have a SQL table with a column of a uniqueideitifer data type, this field allows NULL. I have a couple of records in the table that is NULL.When I tried to update one of the records with...
View ArticleHow to update status to wrong numeric if at least on character exist ?
I work on SQL server 2012 I have keyValue field I need when user write on it any character except 0 to 9 then update status to Not valid number only and if field key value have all numbers only then...
View ArticleHow to write SQL Query and running in parallel within stored procedure ?
I read a bunch of articles and still, can't really know how optimizer determine to run in parallel or not. Here is my simple story, I have a stored procedure used to calculate a formula then return the...
View ArticleParse data from a table row and output the values formatted
I have a table that has multiple values (and sometimes no values) in the column: ReptDesc. I want to extract those values in the following way: If a value is followed by a colon : that is to be...
View ArticleHow to update status where portion key charterer not match charterer on...
I work on SQL server 2012 I face issue I cannot update status with not match character where portion key not equal signature key character based on group id . Group Id Represented as :1$2$3$4$5$6$7...
View Articleadd RECOMPILE for specific query server wide
Hi,I've SQL 2017 and i have a query performance problem. i did try to play with all those trace flag (4199,4136,4137,9481)server wide and play with the indexes and stats and the query is still running...
View ArticleScripting
I don't know what the "scripting" means in SQL Server.(I have experience in T-SQL but not familiar with this term)Does it mean general T-SQL statement?Can anybody give me some idea and example for me...
View ArticleWarning: Null value is eliminated by an aggregate or other SET operation ?
I working on SQL server 2012 I face issue I can't solve this warning Warning: Null value is eliminated by an aggregate or other SET operation so How to solve this warning and not display again my query...
View ArticleRow wise Total in Pivot table ,coming wrong
i am trying to calculating total row wise in Pivot,which is coming wrong.CREATE TABLE #SalesOrder (OrderNo INT,Order_Ref_No VARCHAR(50), Order_date date,Status Varchar(50)); CREATE TABLE #OrderDetail...
View ArticleRTRIM Not working
Hi guys,I have a strange issue when trying to trim some trailing spaces off a string.When I do select RTRIM([ErrorDescription])from [employer].[T_BulkUpLoadNewStarters_Errors]I get (note the two extra...
View ArticleEXEC sp_tables_ex random fail
Hi I installed ACE driver 2010 64 bits on my SQL 2017 64bitsI created a Linked Server to an Excel fileSELECT * FROM myExcelLinkedServer...[Sheet1$] -- Works 100% of the timebutEXEC sp_tables_ex...
View ArticleOne time history load into dimension table
I have a slowly changing dimension table that keeps track record of our current patient from the patients current location.There is also a history table.I want to load the history table into the...
View Articlecreating tables in a database by using proper ANSI SQL syntax 98-364 database...
Hi We are working on 98-364 exam guide and one of the requirements is "creating tables in a database by using proper ANSI SQL syntax"Is someone able to give me T-SQL CREATE TABLE statement that is NOT...
View Article"SELECT * INTO table FROM" a stored procedure? Possible?
I did a search and read a few solutions but they just don't make too much sense to me. Forgive my newbie-ness but I'm still pretty new when it comes to stored procedures. I'm still learning every...
View ArticleT-SQL to Update duplicate records
Ok Im not sure this can even be done but I have a table that has a field with duplicates in it, 970 of them to be exact.What Id like to do is within this field, find duplicate entries and replace one...
View Article