sql server 2012

   why we are using .. in tempdb

  if object_id ('tempdb..#tempcheck') is not null
 drop table #tempcheck

i know its stored in tempdatabase  we access from tempdb to our db we using .. why its only .. any specific reason to put ..
meaning of ..
kowsika deviAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

NerdsOfTechTechnology ScientistCommented:
We will need additional information about the problem, example input, a full SQL statement, and expected output.

To summarize, temp tables are namely used for doing arbitrary calculations or running user-written programs without referencing a data source, to guarantee a known result.

Many database systems have a built in temporary table named DUAL. However, in SQL Server, a temporary table would be an actual table that is created and destroyed for a similar purpose, or simply a SELECT without a FROM clause.

Moreover, in SQL Server, you can also use common table expression (CTE). A CTE resembles a subquery, but unlike subqueries, you can re-use the same data set over and over again in your code (much like a temp table).

SELECT 2*2 AS twosquared 

Open in new window

kowsika deviAuthor Commented:
sorry sir....

i need to know why we are using ..
linked server also we are connecting one server to another server db using  ..
Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
if object_id ('tempdb..#tempcheck') is not null
 drop table #tempcheck
I would think at the later stage of the same codes, it's creating a temp table named: #tempcheck
it would probably creating an error if you creating that temp table again.
There is already an object named '#tempcheck' in the database.

Open in new window

hence, it would be good to drop it if it's exists before you run the codes that generating this temp table.
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

kowsika deviAuthor Commented:
iam asking about .. sir not tempdb and if object_id

i need why we using  2 dots only why cant we use 1 dot or 3 dot is that any specific reason for that 2 dots . this is my question
Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
i need why we using  2 dots only why cant we use 1 dot or 3 dot is that any specific reason for that 2 dots .
that would simply because it's the syntax to be used...
NerdsOfTechTechnology ScientistCommented:
In SQL, dots or period characters (.) could be used to separate objects such as schema(database), tables, and fields.

So ('tempdb..#tempcheck') would mean 'tempdb' (database) . NULL (table) .#tempcheck (field)
Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
i think it probably means:

DROP TABLE [ database_name . [ schema_name ] . | schema_name . ] table_name   

Open in new window

Nitin SontakkeDeveloperCommented:
Typically, fully qualified names of the objects in SQL Server are [servername].[databasename].[schemaname].[objectname]. Hope it is clear to you up-to this point.

Furthermore, typically, whatever is default, it is omitted altogether. For example, if you want to access object on same server and same database, you never mention it. You only mention [schemaname].[objectname]. In fact, in stored procedures and elsewhere, you will also notice that default [schemaname], which [dbo] is also omitted altogether.

Now, you want to check the existence of the object not in your database but in other database on the same server and different database and default schema....so you write [tempdb]..[tablename]. Hope that sort of clarifies.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
NerdsOfTechTechnology ScientistCommented:
The complete name of an object is made up of four identifiers: the server name, database name, schema name, and object name. They appear in the following format:


| database_name.[schema_name].object_name

| schema_name.object_name

| object_name

The server, database, and owner names are known as the qualifiers of the object name. When you refer to an object, you do not have to specify the server, database, and owner. The qualifiers can be omitted by marking their positions with a period. The valid forms of object names include the following:









kowsika deviAuthor Commented:
thanku  Nitin Sontakke ,Ryan Chong,NerdsOfTech for ur help . now am understand for separate objects using .
kowsika deviAuthor Commented:
thanku nitin
NerdsOfTechTechnology ScientistCommented:
No problem, in my last post you will see why 2 dots are used in a row, opposed to 1 or 3 (which are valid depending on the circumstances)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.