Nvarchar data type vs varchar data type - SQL Server 2012
Hi,which are the differences between nvarchar data type and varchar data type?When using nvarchar and when using varchar?Thanks
View ArticleSQL server memory usase
Hi Experts,Can anyone please tell me how can we check SQL server memory usages?Thanks in Advance
View ArticleLeft Outer Join performance is slow when joining two CTEs
I'm new to CTEs in Transact SQl and I need help optimizing very slow performance joining the results of two CTEs together.The first CTE is a number of encounters that returns 147 rows in 2 seconds. The...
View ArticleThe conversion of a varchar data type to a datetime data type resulted in an...
Environment: SQL Server 2008 R2Problem: An error message occurred "The conversion of a varchar data type to a datetime data type resulted in an out-of-range value", when I was trying to flag invalid...
View ArticleUpdating query not pulling any records.
Hi, all I am using an Update query which should update the total columns of the table based on the spread sheet values given by where condition. i have pulled that spread sheet results to a table and...
View ArticleCan Trigger Fail if Record inseration into table is every 30 secs
Hi, I would like to know if the trigger fails to fire if there are records inserted every 15/30 seconds and in the trigger we are calling a procedure.
View ArticleHow to insert a value in a column based on a condition ?
Hi All,The value of sProblemID will determine what value that will end up in [IncidentCategoryID],[IncidentDetailID] columnswhen I try this code insert into...
View ArticleCompare data between two tables all coullms
Hi All,I have a task to compare data for the dev and prod data for the same table ,can some one please help me with the script for this ...Thanks in Advance..
View ArticleCalculating duration of on/off
I'm sure this has been answered out there, I just can't seem to find the right search conditionDECLARE @OrderRanking as table ( Orderdate datetime NOT NULL , Duration int , durstatus int ) INSERT...
View ArticleComments on SQL Preference
I am running into a number of people who are using conditions in a Join that I believe should be used in a where clause. Curious on your comments on what is preferred and why. Below is an example, it...
View ArticleInvalid object name '#TmpTable' whenselecting from temporary table made using...
Hello, Can anyone shed some light on why the following: declare @str varchar(2000)set @str = 'SELECT * INTO #TmpTable FROM FormHistory'exec (@str)SELECT * FROM #TmpTable gives the following error:...
View ArticleStored Procedure And Execution
I want to create a stored procedure in SQL Server2012well thats good,,, i have wrote many stored procedures to work this problem out but none of them workedthe stored procedure has to do the...
View ArticleCount Distinct Over Partition Syntax Error
Count(Distinct [field]) over (partition by [field2]) returns a syntax error at the key word distinctCount(all [field]) over (partition by [field2]) compiles fineI am writing a query to count the number...
View ArticleAn INSERT EXEC statement cannot be nested.Please tel me some good way of...
Hi, The following query is showing error An INSERT EXEC statement cannot be nestedCREATE PROCEDURE [dbo].[Procedur3] @para1 int AS BEGIN CREATE TABLE #tem (…. …. ) select * from detialpar where...
View Articlebatchstarting is not fired.
Hi,When I kick-offed a query, I didn't see the batchstarting show up in sql profiler in my QA server until I cancelled query. However if my moved the same query to DEV or production, I could see the...
View ArticleStoring a Microsoft Word or Excel document in a database table column with a...
We need to store a Microsoft Word or Excel document in a database table column with a varbinary(max) datatype.Here's the table DDL:CREATE TABLE document_t(mydocument VARBINARY(MAX)null)Here's the bcp...
View ArticleHow to combine date and time fields in sql server 2012
DECLARE@TTABLE([Date]VARCHAR(50),[Time]VARCHAR(50));INSERTINTO@T VALUES('2012.01.02','02:12')INSERTINTO@T VALUES('2012.01.02','02:13')INSERTINTO@T VALUES('2012.01.02','02:14')INSERTINTO@T...
View ArticleQuery SQL bulit-in account information
Dear Expert,Is there any known script to query the sql account (bulit-in) information? espcially for creation date, last logon date, etc?Thanks so much.
View Articlehow to fetch the first part of string from a whole lenghty string
Hi,I have a data like - ex1: Auto Update : 10/04/2014 08:04 NEW data: xxxx OLD data: yyyy Ack - etr03 : 10/04/2014 08:13 Auto Update : 10/04/2014 15:24 NEW data1 :xxx OLD data1: yyyy Auto Update :...
View Articlehow to find sql objects in folder having Ansi_Nulls OFF?
I have a folder having thousands of stored procedures and functions. Some of those procs and functions havent been deployed to database.Is there any way i can find all objects in that folder having...
View Article