|
|
-
MisterMagoo Commented 6 Months ago through Blogs
Hi Jacob,
Wouldn't you be safer to use QUOTENAME to wrap the values, to avoid problems with single quotes ?
SELECT
'INSERT INTO Customers (FirstName, LastName, City)
SELECT ' + quotename( ISNULL(FirstName, '') , '''') + ','
...
|
-
MisterMagoo Commented 8 Months ago through Just Learned
Dear Satyajit,
I just received this comment from you - which does not seem to show up on site...
Quote : "Please check your facts before mentioning any post as incorrect. I have mentioned to avoid using it...it means as a good practice one should ...
|
-
MisterMagoo Commented 8 Months ago through Just Learned
My previous comment was written on a mobile, so it was brief, but here is how your query should be written:
SELECT temp.a
FROM #temp AS temp
WHERE temp.a IN (SELECT temp1.b FROM #temp1 AS temp1) ;
SELECT temp.a
FROM #temp AS temp
...
|
-
MisterMagoo incorrect 8 Months ago through Just Learned
Found another good reason to avoid using IN clause in your TSQL Queries. See the example below:
<pre style="font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;;background-image:URL(http...
|
-
MisterMagoo Liked 8 Months ago through Just Learned
Found another good reason to avoid using IN clause in your TSQL Queries. See the example below:
<pre style="font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;;background-image:URL(http...
|
-
MisterMagoo Commented 8 Months ago through Just Learned
That is correct.
You selected "a" in your IN clause so it will return every row.
Another reason to use aliases......
|
-
MisterMagoo Liked 8 Months ago through Pages
We wish to use these pages for publishing various documents, announcements, FAQ etc related to beyondrelational.com...
|
-
MisterMagoo Commented 8 Months ago through Just Learned
Dimitri is correct, binary_checksum and checksum are both inaccurate for matching data.
Eriks alternative solution is better....
|
-
MisterMagoo incorrect 8 Months ago through Just Learned
Copy And paste Query
Create table #temp1
(
id int ,
Name varchar(50),
City varchar(50)
)
Create table #Staging_temp2
(
id int,
Name varchar(50),
City varchar(50)
)
insert into #temp1
...
|
-
MisterMagoo Liked 8 Months ago through Just Learned
Copy And paste Query
Create table #temp1
(
id int ,
Name varchar(50),
City varchar(50)
)
Create table #Staging_temp2
(
id int,
Name varchar(50),
City varchar(50)
)
insert into #temp1
...
|