Viewing 15 posts - 14,056 through 14,070 (of 15,381 total)
Something like this.
Update MyTable
set MyField = b.Value
from MyTable mt
join OtherTable b on mt.KeyField = b.KeyField
--optional where clause or whatever filtering here
September 12, 2011 at 12:57 pm
If you want to return a varchar value you have to use an output parameter or make your last statement in the procedure a select statement. SQL returns an integer...
September 12, 2011 at 12:29 pm
SQL Guy 1 (9/12/2011)
September 12, 2011 at 9:06 am
Are you looking into something that is a problem or just finding something that appears strange? What are you trying to accomplish or what are you looking for?
September 9, 2011 at 4:33 pm
Fairly simple to do with ROW_NUMBER and the partition by by clause. If you can't figure it out and want some help post your ddl and I can give you...
September 9, 2011 at 4:29 pm
select top 1 [my field here]
from Mytable
join MyHistoryTable on [my join criteria]
order by [My field that tells me which record is the latest].
You really should be using a datetime field...
September 9, 2011 at 2:33 pm
Try this on a TEST server. The code below has the recompile hints. It might help the optimizer with a better execution plan. I make no promise as to the...
September 9, 2011 at 2:26 pm
Meaning it is taking a LONG time?
September 9, 2011 at 2:20 pm
Here is a post from Lynn with some common datetime routines. http://www.sqlservercentral.com/blogs/lynnpettis/archive/2009/3/25/some-common-date-routines.aspx Very good resource.
September 9, 2011 at 1:11 pm
Are the row counts on the base tables and the temp table similar? Rowcounts can adversely affect the execution plan especially with large temptables. I have the suggestion to use...
September 9, 2011 at 1:08 pm
OK I tossed some quick sample data together.
CREATE TABLE [dbo].[EmailTemplateFieldsP](
[FieldPID] [int] IDENTITY(1,1) NOT NULL,
[ProjectID]...
September 9, 2011 at 9:20 am
September 9, 2011 at 8:34 am
The table parameter sounds like a perfect fit. However, I don't think you need a cursor or any kind of looping at that point. You would want to update the...
September 9, 2011 at 8:20 am
ash0550 (9/9/2011)
Say it contains 3 rows name,age and gender
I want to retrieve name and gender through age.
Instead of using Select Name,gender from...
September 9, 2011 at 8:14 am
No need to close SSMS. You just need to refresh the local intellisense cache. ctrl - shift - R or use the menu Edit -> Intellisense -> Refresh Local Cache....
September 8, 2011 at 12:50 pm
Viewing 15 posts - 14,056 through 14,070 (of 15,381 total)