how do i update some sql tables to server automatically for every 30 min
I am making a windows application and using sql server 2008r2 where i the data is stored in a local server where the data is getting stored now how can i update some tables from my database to the...
View ArticleHow to UPDATE STATISTICS in SQL Server 2000?
Hi All,I am trying to UPDATE STATISTICS for a table in a database and when I do so and verify the count of the table, I still get the old stats from the sysindexes table. I was wondering whenever a...
View ArticleQuery building
<section class="j-original-message">Hi all,I am writing a database application and have ran into an issues that I am having a hard time resolving and would like some help. The application tracks...
View Articlehow do i search for special characters in sql server 2008 r2?
hi , i got the requirements like i have to search for special characters like the names who are having single quotes in their names c'te ex: select * from names where name like 'c'test%' for this i...
View ArticleExecution of SSIS package in T-SQL to return just a record to indicate...
Hi, I am executing a SSIS package in T-SQL via xp_cmdshell, I am doing it this way because my client wants it to be done. I am using SQL Server 2008 R2 environment.CREATE PROCEDURE...
View ArticleSQL join 2 date tables
Hi,I am attempting to join 2 header tables "receipt" and "plan" at date (receiptdate=date)I'm not getting an output and I suspect a join issue - any ideas:SELECT dbo.tbReceipt.ReceiptDate,...
View ArticleHow can Optimize this query . when i try to run this query it take more than...
SELECT x1yzef Case When DATEDIFF(dd, CreateDate, GetDate()) >= 120 Then 1 Else 0 End As Over120Flag, Sum(Units) As TtlUnits, Sum(VisitCt) As TtlVisitCt,...
View ArticleSQL Tuning for 50 million rows--- Group by
For example i have 50 million+ rows in a table with columns Customer_ID, Order_ID and trans_date. I need a query to return customers with more than 2 orders over the past 60 days.Select customer_id...
View ArticleData integrity issue
We are using a SQL Server 2012 backend for our software. Right now I'm trying to improve our orders form, where an existing order might be opened, modified, then saved. When it is saved, several...
View ArticleHow to execute a batch file / cmd file from t-sql
Hello,Am trying to execute a batch / cmd file with dynamic parameter to the batch file using t-sql / xp_cmdshell.Basically am trying to execute a robocopy command from t-sql - read somewhere that this...
View ArticleProblem in executing Robocopy using xp_cmdshell
Hi,Can you please advice me on how to execute the robocopy command which supposed to get dynamic input - filenameand do the copy operation thru xp_cmdshell (i.e) thru t-sqlsample:Set _filename =...
View ArticleSame query, slight alteration - very different execution times!
Hi everybody,I have a stored procedure I need to optimize. I am trying different variations of the same query and two same variations that should be identical in execution plans yield very different...
View ArticleQuery using "or" statement versus Query Using "Union All". Logically the same...
Trying to understand why these two queries which are logically the same do not use the same indexes.QUERY #1 SELECT TOP 400 * FROM AuditLog WITH ( NOLOCK ) WHERE CustomerID = 2379 AND PracticeID = 55...
View ArticleTrying to create partititoned table but getting non-deterministic error
I am trying to create partitioned table but I am getting non deterministic error on partition ID which is compute columnMsg 4936, Level 16, State 1, Line 11Computed column 'partitionID' in table...
View ArticleDoes anyone know how to find a period character in a string?
I have tried CHARINDEX('.', column) and PATINDEX('%.%', column) but neither have worked.
View Articleinsert values
i need to insert value like thisinsert into emp1select 1,'code1',0union allselect 2,'code1',0union allselect 1,'code2',0union allselect 2,'code2',0i dotn want multiple union all statement,how can i...
View Articledata validation - pinpoint the differences between datasets
Hi - I'm trying to come up with an efficient way to compare datasets and pinpoint their differences. Ideally, a generic method that eliminates the need to explicitly state column names so it can be...
View ArticleWhen creating a view, execute code found in a table
I use SQL Server 2012; we have a table where the user can save data needed to build a view. This table looks like this:terminal selection_code ABC123 AND emp.Employee_Code = 'JOHN'We need to create a...
View ArticleTable exclusive lock
I have one session opened and I execute the query:BEGIN TRAN SELECT * FROM Inventory with (updlock, holdlock) WHERE ItemID = 796Transaction is still opened. If i open the second window, and I execute...
View Articleexport data to xml while maintaining proper relationships
I am trying to export data from some tables that have relationships to each other into xml format.I am able to export the data to xml but I noticed the relationships do not stay intact.For example...
View Article