SQL Temp Table

Source: Internet
Author: User

Update company set Tfn=null where tfn= '-2147483648 '
Update application set Companytfn=null where companytfn=-2147483648

UPDATE Company set Tfn=null where CAST (TFN as int) <0
UPDATE Application Set Companytfn=null WHERE companytfn<0


Select object_id from sys.columns where name like '%hin% '
SELECT * from Sys.tables where object_id in (select object_id from sys.columns where name like '%hin% ')


/////////////////////////////////////////////////////////////////////////////////////////////////


drop table #Tmp
CREATE TABLE #TMP
(
ID int IDENTITY (FIRST) NOT null--creates the column ID and adds 1 each time a new record is added
DeptID int,
Deptname varchar (50),
Datatimes datetime
Primary key (ID)--defines the primary key for the #tmp of the temporary table ID
);

Insert INTO #TMP Exec deptdisplay ' candied fruit ', 5

Select ID,
(Case DeptID "5 ' Then ' HAHA '
When ' 4 ' Then ' NoNo '
Else ' Yeye '
End
) as Ids,
Deptid,deptname, (Select DATEADD (Q,1,isnull (datatimes, ' 1900-2-3 ')) as TT from #TMP


Declare @TempGroup table (ID int,deptname varchar (), datatimes datetime)
Insert INTO @TempGroup Exec deptdisplay ' candied fruit ', 5
Select ID,
(Case ID if ' 5 ' Then ' HAHA '
When ' 4 ' Then ' NoNo '
Else ' Yeye '
End
) as Ids,
Id,deptname, (Select DATEADD (Q,1,isnull (datatimes, ' 1900-2-3 ')) from @TempGroup
UNION ALL
Select ID,
(Case ID if ' 5 ' Then ' HAHA '
When ' 4 ' Then ' NoNo '
Else ' Yeye '
End
) as Ids,
Id,deptname, (Select DATEADD (Q,1,isnull (datatimes, ' 1900-2-3 ')) from @TempGroup
SELECT DISTINCT * from @TempGroup

/////////////////////////////////////////////////////////////////////////////////////////////////

SQL Temp Table

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.