Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

SQL: INSERT INTO statement not working

$
0
0

SQL Version:  2008 R2

I'm trying to run this code, but it never completes and I have to manually terminate it.  The same thing happens is I only run the SELECT statement portion (without including the Begin Tran and the IF @@ROWCOUNT....).

Don't quite understand why?

CODE:

 Begin TRAN
 
 INSERT INTO vPCCertificateTypes (VendorGroup, CertificateType, Description, Active, Category)
 
 SELECT HQCo, 'MBE', 'Minority-owned Business Enterprise', 'Y', 'Affirmative Action'
 
 FROM HQCO
 Where HQCo IS NOT NULL
  AND HQCo <> 100
  AND HQCo <> 99
 IF @@ROWCOUNT <> 44 ROLLBACK ELSE COMMIT


Bob Sutor


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>