[thelist] SQL Server: How Can I Convert VARCHAR to INT?

Rory.Plaire at wahchang.com Rory.Plaire at wahchang.com
Fri Aug 17 12:23:16 CDT 2001


| aside for the moment with the intent to come back to it. | When I did get
back to it, I got it to work.

Ha! This is the main reason I get up to walk around/look at nature/read
emails on this list. My brain does this funny thing, too.

|     My WHERE criteria were:
| 
| where patindex('%[A-Z]%',field) <> 0

Good work! Very clean and elegant. There is something compelling about a
quasi-recursive statement like this that moves the currents of my heart and
reverberates in the canyons of my soul.

|     So, if you, or any other SQL gurus, can see a more 
| efficient way to
| accomplish this task, I am always eager to learn.

Hm. I wouldn't consider my own self a guru, but perhaps I can give this
journeyman insight: create the column with a default value constraint of
null. So something like:

CREATE TABLE tblTemp
(	newIntField	int	NULL
		DEFAULT	NULL,
	....
)

Though this wouldn't work for the fields containing a single blank. I really
think, in the light of this, that the UPDATE you employed to be efficient
and efficacious. You could run it in a batch before doing a SELECT INTO
statement to create the new table.

<rory disposition="jovially" alt="8)"/>




More information about the thelist mailing list