x
login about faq Site discussion (meta-askssc)

What is the use of #?

Just wanna know, if what is the use of # symbol beside the table name PaySlip?

CREATE TABLE #PaySlip(
   WorkId int,
   PName nvarchar(max),
   Client nvarchar(max),
   PayPeriod nvarchar(max),
   PayDt nvarchar(max),
   Particulars varchar(max),
   RefInfo nvarchar(max),
      DAmt nvarchar(max),
   CAmt nvarchar(max),
   RunBal nvarchar(max),
   ToDeBit nvarchar(max),
   ToCredit nvarchar(max),
   ToPay nvarchar(max),
   AcctNo nvarchar(max),
   --
   Template nvarchar(max),
   Rate decimal(18,2)
   )

Thanks and regards.

more ▼

asked Jul 25 '12 at 01:11 AM in Default

jeff020590 gravatar image

jeff020590
1 1 2 3

(comments are locked)
10|1200 characters needed characters left

2 answers: sort voted first

This creates a temporary table which is locally scoped to the connection. This temporary table will be automatically dropped when the connection using it is terminated (or the table is explicitly dropped).

You can also have ## global temporary tables which are server scoped, thus accessible by any connection, and automatically dropped when there are no more connections using it.

Finally you can have @ table variables which are scoped to the query and not stored beyond that.

more ▼

answered Jul 25 '12 at 04:41 AM

SirSQL gravatar image

SirSQL
4.6k 1 3

(comments are locked)
10|1200 characters needed characters left

The symbol # show the object is temporary

more ▼

answered Jul 25 '12 at 01:31 PM

basit 1 gravatar image

basit 1
439 36 54 80

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments



Facebook logo Follow Ask SSC on Facebook
Find Ask SSC on Google+
linkedin logo Find us on LinkedIn

Topics:

x340
x30

asked: Jul 25 '12 at 01:11 AM

Seen: 418 times

Last Updated: Jul 25 '12 at 01:31 PM

Copyright © 2002-2012 Simple Talk Publishing. All Rights Reserved. If you have any queries, please contact the site administrators.
Ask SQL Server Central is a community service provided by Red Gate.