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 2008 Forums
 Transact-SQL (2008)
 Nolock and Convert issue

Author  Topic 

CoffeeAddict
Yak Posting Veteran

94 Posts

Posted - 2010-06-17 : 12:34:44
I'm having a couple malformed syntax issues and not sure how to resolve this or change it around to make T-SQL happy:

select top 1000 *
from Orders o nolock
inner join Cash c
on c.orderid = convert(varchar(10), o.id)
where type = 'Credit'
and cNumber <> ''
order by createdOn desc

you can't put nolock after the o? I get an error on that
Also, it's not liking the convert syntax here

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-06-17 : 12:49:34
(nolock)

convert is ok.
The error a consecutive fault I think.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

CoffeeAddict
Yak Posting Veteran

94 Posts

Posted - 2010-06-17 : 12:50:14
Thanks. Did not know the () really mattered here.
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2010-06-17 : 12:59:40
Sure you want the chance of incorrect data? [url]http://sqlblog.com/blogs/andrew_kelly/archive/2009/04/10/how-dirty-are-your-reads.aspx[/url]

--
Gail Shaw
SQL Server MVP
Go to Top of Page
   

- Advertisement -