Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Development - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 3145

Touble with query using a temp table to compare and update existing table

$
0
0
Let me post the code and then the problems I am having with it.[code="sql"]if object_id('dbo.namefile', 'u') is not null drop table dbo.namefilecreate table dbo.namefile( name varchar(255) not null primary key )bulk insert dbo.namefilefrom 'f:\list.csv'with (datafiletype = 'char', fieldterminator = '","', rowterminator = '\r', errorfile = 'f:\inp_err.log') update dbo.MeasurementLimit set LowLimit = 1from namefile as nfjoin EntityName as en on en.EntityName = nf.namejoin MeasurementLimit as ml on en.uid = ml.UIDwhere en.EntityName = nf.name[/code]If I run a simple query against the namefile table it will return 113 records There should be 112 1 blank record shows up don't know why...but the real problem is if I run the above query or even this simple one[code="sql"]select * from namefile nfjoin entityname en on nf.listname = en.entitynamewhere nf.listname = en.entityname[/code]it will only return/update 1 record when there should be 112Thanks for any help or suggestions there are to be had

Viewing all articles
Browse latest Browse all 3145

Trending Articles