SQL 2012 :: Tablediff And Nvarchar (max)

Oct 9, 2014

Using MSSQL Server 2012 Standard on a Windows 2008R2 Standard server.

For the tablediff utility MSDN says:

The Transact-SQL script generated to bring the destination table into convergence does not include the following data types: varchar(max), nvarchar(max), timestamp...etc

We have a small replication job running and one of the tables contains a timestamp field. After running tablediff the generated script contains a note:

-- Column(s) AccessTS are not included in this script because they are of type(s) text, ntext, varchar(max), nvarchar(max), varbinary(max), image, timestamp, or xml. Columns of these types cannot be updated by tablediff utility scripts; .....

The updated record is in the script file, but the timestamp field is omitted.

All good so far.

However, another table contains nvarchar(max) fields. The scripts that are generated for these tables do not contain the above message and instead contain these nvarchar(max) fields in both the update and insert into statements!

So why does it say it will ignore these types of fields, but then actually include the nvarchar(max) ones in the generated scripts?

View 2 Replies


SQL 2012 :: Tablediff With Linked Server

Jan 26, 2015

I have created a linked server that point to a firebird database, everything is fine, I can query the database with something like


Now , can i use tablediff utility with this linked server. If yes, any example ..

I would say also that performance is not very important to me. this would be used at the end of the day to make some sort of replication by generating a sql script with datadiff, and run it on a local sql server database and a web based SQL database. The replication is not an option since i am using a shared web hosting and replication is disabled on it .

View 2 Replies View Related

SQL Server 2012 :: Converting Nvarchar To Datetime

Jul 24, 2015

I have a column name DateofRecord and it is nvarchar type..all the values in this column are like this


My requirement is to convert this column into Datetime ?

I tried so many ways using cast and convert functions like cast(dateofrecord,datetime) or like convert(datetime,replace(DateofRecord,'"','''')) ..it didnt worked..

View 9 Replies View Related

SQL Server 2012 :: Explicit Casting Varchar And Nvarchar Columns?

Feb 26, 2014

I know that if I have an nvarchar column I can use an equality like = N'supersqlstring' so it doesn't implicit cast as a varchar, like if I were to do ='supersqlstring'. And then I'll be a big SQL hero and all my stored procedures will run before a millisecond can whisper.

But if I'm comparing an nvarchar column to a varchar column, is it better to cast the varchar 'up' to an nvarchar or cast the nvarchar 'down' to a varchar?

For instance:

cast(a.varchar as nvarchar(100)) = an.nvarchar


cast(an.nvarchar as varchar(100)) = a.varchar

Leaving aside non-matching, like (at least I don't think) that SQL considers the varchar n to be equal to the nvarchar ń, what's the best way to handle this?

Pretend for a moment that each column contains a mixed letter and number ID with no accented or wiggly-squiggly Unicode characters; it's just designs clashing.

Is there a performance hitch doing it one way or another? Should I use COLLATE? Should one of the columns be altered?

View 8 Replies View Related

SQL Server 2012 :: Sorting By Alphanumeric Table Column Of NVARCHAR Datatype

Sep 24, 2015

I am trying to sort my sql resultset by an alphanumeric column of a table which is of NVARCHAR datatype. The sample data is given below:

CREATE TABLE #Activities(activityName NVARCHAR(100))

INSERT INTO #Activities VALUES('Field phase S14-04932-01')
INSERT INTO #Activities VALUES('Phase reporting')
INSERT INTO #Activities VALUES('Phase running')

[Code] ....

The output of the query is like this:

E1 0DAA1
E2 0DAA2

[Code] .....

The output what I require is this:

E1 0DAA1
E2 0DAA2

[Code] ....

View 9 Replies View Related

SQL Server 2012 :: Case Statement On Nvarchar With Literal String Comparison To Varchar?

Apr 14, 2015

how SQL 2012 would treat a literal string for a comparison similar to below. I want to ensure that the server isn't implicitly converting the value as it runs the SQL, so I'd rather change the data type in one of my tables, as unicode isn't required.

Declare @T Table (S varchar(2))
Declare @S nvarchar(255)
Insert into @T
Values ('AR'), ('AT'), ('AW')
Set @S = 'Auto Repairs'
Select *
from @T T
where case @S when 'Auto Repairs' then 'AR'
when 'Auto Target' then 'AT'
when 'Auto Wash' then 'AW' end = T.STo summarise

in the above would AR, AT and AW in the case statement be treated as a nvarchar, as that's the field the case is wrapped around, or would it be treated as a varchar, as that's what I'm comparing it to.

View 3 Replies View Related

Tablediff Bug?

Sep 12, 2006


I recognized a strange behaviour when using tablediff. Because I don't want to replicate all columns, I create two views on selected attributes and compare them.

Have two tables:
create table t1 (timestamp timestamp, b int PRIMARY KEY, c varchar(30))create table t2 (b int PRIMARY KEY, c varchar(30))

and two views:
create view vt1 as select b, c from t1 create view vt2 as select b, c from t2

Compare the views with tablediff and get a failure:
... vt1 and vt2 ... have different schemas and cannot be compared.

Now I just find out that it works when table t2 also has a timestamp column.

drop table t2create table t2 (b int PRIMARY KEY, c varchar(30), ts timestamp)

Compare the views again with tablediff and get:
... vt1 and vt2 ... are identical.

What dou you think, do I always need the same datatypes in source- and target-table I want to compare, even if a create a subselection via views?


View 5 Replies View Related

Tablediff Utility Bug?!?

Aug 14, 2006

In my transactional push replication I had differences, which were reported correctly by the utility tbalediff.

I created with the tablediff utility all necessary statements to correct them.

Afterwards I ran tablediff again to check if everything is ok.

It wasn't, I got a lot of mismatches.

The reason for those mismatches are columns from type "float". It looks like that float values are not generated correctly in insert statements. We had differences in the values and from that point on we have mismatches.

Does anyone has an idea how to get rid of those reported mismatches?!?!

I will report this also as a bug.



View 11 Replies View Related

TableDiff Utility

Apr 9, 2007

What SQL Server 2005 feature do I need to install to get the tablediff.exe utility installed?


View 1 Replies View Related

TableDiff Utility

Apr 9, 2007

What feature do I have to install in SQL Server 2005 to get the tablediff.exe installed?


View 3 Replies View Related

TableDiff Utility

Apr 9, 2007

What SQL Server 2005 feature do I need to install to get the TableDiff utility? I have the developer edition.


View 1 Replies View Related

TableDiff Stopped Functioning

Jul 31, 2007


TableDiff Stop Functioning on 2million records with 1.8milion changes on a particular row. Only happen if "-f" is specified. Anyway to work around this?


View 1 Replies View Related

Tablediff Utility Download

Nov 12, 2007

I want to use Tablediff utility. It has not been installed into my system. Any idea, from where I can download it? I have both sql 2000 and sql 2005. May I use tablediff in both sql 2000 and 2005?

View 6 Replies View Related


Jul 11, 2007

I'm trying to put together an automated system that uses sp_publication_validation & the tablediff utility to automatically sync up our subscribers to the publisher. What I'm noticing is that the sp_publication_validation sys proc gets run on the publisher. It does a rowcount and binary_checksum of each article in a specified publication. When I do a binary_checksum myself I've verified these results. For some reason a column could be a smalldatetime on the publisher and all the subscribers, however, the binary checksum will be different IF RUN from the publisher for that column/row/table. If I run the binary_checksum from the subscriber (instead of accross ODBC using a linked server command) I'm seeing matching checksums.

The result of this is I'm seeing a bunch of records that are actually identical coming through the tablediff command as different. I have a few questions. Has anyone ever run accross this issue before? I believe it has something to do w/ ODBC. I'm willing to work/share a pretty nice SSIS package that I am developing if somebody could assist me in figuring a way around this issue.



View 3 Replies View Related

Tablediff Utility For SQL Server 2000?

Dec 18, 2006

Does anyone know if there is a utility available in SQL Server 2000 equivalent to the Tablediff utility in 2005? While reinitializing a Subscriber, I got the error "The row was not found at the Subscriber when applying the replicated command." I would like to identify the location of the data to fix at the Subscriber. In the interim, I changed the Distribution agent from the default to "Continue replication on data consistency errors," which successfully replicated changes, except for the errors. Is the stored procedure sp_publication_validation the only option for SQL Server 2000? This ran successfully after the replicated changes were processed.

View 3 Replies View Related

Tablediff Utility Without 'delete' Command.

Apr 23, 2008

I am presently using 'tablediff' utility of SQLServer 2005 to compare tables located on two different servers. My real intension is to backup data from Serv1 to Serv2, except that I wish to update the tables on server2 with only newly inserted rows and updated rows and NOT deleted rows.

In short, I want the final .sql file generated by the tablediff utility to contain only 'Insert' and 'Update' statements and NOT 'Delete' statements.

I hope someone can help me in this regard.

Thank you,

View 6 Replies View Related

TableDiff Out Of Memory Exception On Large Tables.

Sep 20, 2007

I hope I am posting this in the right forum.

I am using tableDiff.exe to create a diff SQL script for a very large table (~4 million rows).

After a few minutes, I recieve a "System.OutOfMemoryException".

I have 4GB of ram on the machine executing the table diff.
The server is 32-bit, so adding ram is not an option.

I am executing the following command line:

Code Snippet

TableDiff.exe" -sourceserver "SERVER" -sourcedatabase "SourceDB" -sourcetable "Table1" -destinationserver "SERVER" -destinationdatabase "DestDB" -destinationtable "Table1" -f "C:TableDiffsTable1"

I have seen reports of other users executing tableDiff against 2million row tables.

Is there anyway to buffer tableDiff, so that I do not run out of memory on the server?

Could anything else be causing this error?


View 3 Replies View Related

The Parameterized Query '(@contactdate Nvarchar(4000),@dnbnumber Nvarchar(4000),@prospect' Expects The Parameter '@futureopportunity', Which Was Not Supplied.

Jan 10, 2008

HI, I am running the below method which returns this error: The parameterized query '(@contactdate nvarchar(4000),@dnbnumber nvarchar(4000),@prospect' expects the parameter '@futureopportunity', which was not supplied" Please help.Private Shared Sub InsertData(ByVal sourceTable As System.Data.DataTable, ByVal destConnection As SqlConnection)
' old method: Lots of INSERT statements Dim rowscopied As Integer = 0
' first, create the insert command that we will call over and over:
destConnection.Open()Using ins As New SqlCommand("INSERT INTO [tblAppointmentDisposition] ([contactdate], [dnbnumber], [prospectname], [businessofficer], [phonemeeting], [followupcalldate2], [phonemeetingappt], [followupcalldate3], [appointmentdate], [appointmentlocation], [appointmentkept], [applicationgenerated], [applicationgenerated2], [applicationgenerated3], [comments], [newaccount], [futureopportunity]) VALUES (@contactdate, @dnbnumber, @prospectname, @businessofficer, @phonemeeting, @followupcalldate2, @phonemeetingappt, @followupcalldate3, @appointmentdate, @appointmentlocation, @appointmentkept, @applicationgenerated, @applicationgenerated2, @applicationgenerated3, @comments, @newaccount, @futureopportunity)", destConnection)
ins.CommandType = CommandType.Textins.Parameters.Add("@contactdate", SqlDbType.NVarChar)
ins.Parameters.Add("@dnbnumber", SqlDbType.NVarChar)ins.Parameters.Add("@prospectname", SqlDbType.Text)
ins.Parameters.Add("@businessofficer", SqlDbType.NChar)ins.Parameters.Add("@phonemeeting", SqlDbType.NVarChar)
ins.Parameters.Add("@followupcalldate2", SqlDbType.NVarChar)ins.Parameters.Add("@phonemeetingappt", SqlDbType.NVarChar)
ins.Parameters.Add("@followupcalldate3", SqlDbType.NVarChar)ins.Parameters.Add("@appointmentdate", SqlDbType.NVarChar)
ins.Parameters.Add("@appointmentlocation", SqlDbType.NVarChar)ins.Parameters.Add("@appointmentkept", SqlDbType.NVarChar)
ins.Parameters.Add("@applicationgenerated", SqlDbType.NVarChar)ins.Parameters.Add("@applicationgenerated2", SqlDbType.NVarChar)
ins.Parameters.Add("@applicationgenerated3", SqlDbType.NVarChar)ins.Parameters.Add("@comments", SqlDbType.Text)
ins.Parameters.Add("@newaccount", SqlDbType.NVarChar)ins.Parameters.Add("@futureopportunity", SqlDbType.NVarChar)
' and now, do the work: For Each r As DataRow In sourceTable.RowsFor i As Integer = 0 To 15
ins.Parameters(i).Value = r(i)
'If System.Threading.Interlocked.Increment(rowscopied) Mod 10000 = 0 Then
'Console.WriteLine("-- copied {0} rows.", rowscopied)
'End If
End Using
End Sub

View 6 Replies View Related

Compare Nvarchar(10) With Nvarchar(1000)

Sep 4, 2007

I had this question for quite a long time.

It seems the latter one don't take any extra storage space than the previous one.

As long as the real string length is less than 10.

Is that mean the latter one not cost anything?

I once heard the different is when they are in memory. But not sure of it.

Can anyone explain it and provide some official reference on it?


View 6 Replies View Related


Sep 2, 2007

Hi All,
   The storage reserverd for nvarchar(m) is 2*m+ 2 extra bytes.
   I understood each character requires because it supports unicode format.
   Why extra two bytes are required?

View 1 Replies View Related


Jan 31, 2007


What is the maximum lenght when using nvarchar(MAX)?

If I want to save a really long text, should be this the data type to use?

I am using SQL 2005.


View 2 Replies View Related


Dec 11, 2007

Does anyone know the formula to calcuate the space occupied by an nvarchar(max) column for the purposes of sizing a table?

View 1 Replies View Related

Using Nvarchar(MAX) Instead Of Nvarchar(#)

Feb 19, 2008

Is it bad form to use nvarchar(MAX) in place of column types with specific lengths like nvarchar(50)? Are there performance issues? Because to me (a novice), it appears that I would save space by using nvarchar(MAX) everywhere.

Same question applies to varbinary(MAX) as well.



Jim Geurts
Personal: http://www.biasecurities.com
Work: http://propertycenteronline.com

View 3 Replies View Related


May 22, 2008

I have an SSIS pkg, that gets data from Lotusnotes db and loads into SQL Server, using ODBC Driver for Notessql driver . I have a comments, field, in Lotusnotes which has comments>8000 chars in lotusnotes. Hence I created my destn SQL Table with datatype NVARCHAR(MAX) so that it can uplaod the comments that are >8000 chars.
However, every time I run the ssis pkg , the destn table is bringing only 250 chars ONLY in the comments field , and truncates the rest of the chars.
And I see the reason is because, on my ODBC Serttings for Lotusnotes, There is a section for NOTESSQL options
where the "Max length of text fields" set to 254. hence it brings only 254 chars into SQL.
However, If I increase that option "Max length of text fields" to 8000 or some higher number, the sssis package errors out on the datareader source itself, err is"

"The output column 'comments' has a length that is not valid.

Pl advise how can I load all the comments which are more than 8000 chars from lotus notes into SQL, AND KEEPING THE ODBC settings, the "Max length of text fields" TO 254 Only.

View 5 Replies View Related

Order By Nvarchar

Feb 2, 2007

I have a scenario to sort on an nvarchar (50) field and I need to keep any changes to the sproc in the ORDER BY clause if possible.  This field will contain strings such as...
abc-217c, abc-15a, abc-9a, abc-7b, abc-17ar, etc...
The issue I'm having is when the records are sorted, they are returned as...
abc-15a, abc-17ar, abc-217c, abc-7b, abc-9a,etc...ordering numerically on the first numeric character in the string ie, 1,1,2,7,9)
However, I need the numeric component to be treated as a whole number and order in this fashion...
abc-7b, abc-9a, abc-15a, abc-17ar, abc-217c (7,9,15,17,217, etc)
I feel pretty sure that this issue has come up before...can anybody provide a working example that would provide a simple(or not so simple) solution?

View 2 Replies View Related

Nvarchar To Text

Aug 26, 2007

Hello, I have a column in my table that is a nvarchar.The information that we need to store in this column has exceeded the limit.Can we simply change the datatype to 'text' ?  Will there be any issues that we might experience? Thank you in advance.  

View 1 Replies View Related

Nvarchar To Varchar

Aug 28, 2007

i have used nvarchar as my datatype in sql server 2000 now
i have decided to change to varchar as i can increase the character length from 4000 to 8000
Do I Lose data if i change the datatype.

View 7 Replies View Related

Nvarchar To Varchar

Jul 10, 2003

I have a table using nvarchar(for what ever reason which beyond me why its a nvarchar...) that I would like to change to a varchar. There is no unicode in the fields so I don't have to worry about but I don't want to lose any text data. Will coverting the data type lose data?


View 9 Replies View Related

Converting Nvarchar To Int

Oct 28, 2004

Hello all,

I'm trying to convert a nvarchar datatype to int
(ie:1234-56-78 to 12345678) . These values are primary keys in two tables. Both these tables have 3500 rows of this key type. I want to convert this to a int so I can make it a AutoNumber primary key so I can increment it. Is this possible? If so, how do I do it. Do I need to delete the dashes first some how? I fairly new to database adminstration, so any guidance will be greatly appreciated.

Thank You

View 2 Replies View Related


May 16, 2006

So I have an existing table that looks like:


I am converting this table to something that will be multi language compliant. My question is, I know that NVARCHAR's take double the space of a VARCHAR. Do I actually need to double the length of the VAL field to store the same amount of data or does the DB handle that?

Basically I want to store a 128 character NVARCHAR.. do I need to set my table up like this:




View 3 Replies View Related

NText Vs NVarChar

Sep 27, 2005

I am new to SQL Server and would like to hear opinions on pros and cons of using nText vs. nVarChar data type for following uses:

URLs (up to 260 bytes)
Addresses (50-300 bytes)
Descriptions and comments (50-2,000 bytes)
Memos (up to 8000 bytes)


View 8 Replies View Related

NText And NVarChar.

Feb 6, 2007


I need to save some news text in an SQL table. The text can be long.
1. Should I use nvarchar(MAX) or nText?
2. And what is the difference between nText and Text?

I am using SQL 2005.


View 4 Replies View Related

Ntext To Nvarchar

Feb 15, 2008

Dear All,
i'm trying to convert the datatype from ntext to nvarchar.i'm getting error. is it not possible?

Even you learn 1%, Learn it with 100% confidence.

View 3 Replies View Related

Copyrights 2005-15 www.BigResource.com, All rights reserved