Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 LEFT vs CAST

Author  Topic 

henrikop
Constraint Violating Yak Guru

280 Posts

Posted - 2009-06-25 : 07:56:01
In a staging area I need to specify a string size when I copy data from one table to another. The source table has always NVARCHAR(100) while the destination table has variable size

I use something like

UPDATE Dest SET Column1 = LEFT (source.Column1, 25) ....

Would

UPDATE Dest SET Column1 = CAST (source.Column1 AS NVARCHAR (25)) ....

peform better or worse?

Because the DB server is constantly in use I cannot proper compare test-results. Would anyone know the answer?



Henri
~~~~
There's no place like 127.0.0.1

asgast
Posting Yak Master

149 Posts

Posted - 2009-06-25 : 08:01:59
CAST will require more time
Go to Top of Page
   

- Advertisement -