Quantcast
Channel: Transact-SQL forum
Browsing all 23857 articles
Browse latest View live

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 Article


SQL server memory usase

Hi Experts,Can anyone please tell me how can we check SQL server memory usages?Thanks in Advance

View Article


Left 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 Article

The 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 Article

Updating 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 Article


Can 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 Article

How 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 Article

Compare 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 Article


Calculating 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 Article


Comments 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 Article

Invalid 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 Article

Stored 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 Article

Count 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 Article


An 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 Article

batchstarting 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 Article


Storing 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 Article

How 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 Article


Query 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 Article

how 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 Article

how 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
Browsing all 23857 articles
Browse latest View live