You are here: Re: Using USER value in SQL code « MsSQL Server « IT news, forums, messages
Re: Using USER value in SQL code

Posted by Erland Sommarskog on 09/21/06 21:53

(billharrison9@gmail.com) writes:
> I need to be able to drop a table after a user is done with it. I have
> tried something like,
>
> DROP TABLE USER.tblEducation_SAP1
>
> but I get an error.

And the error message is? Of course, if that is the exact command line
you would get a syntax error since USER is a reserved word in T-SQL. But
I don't know whether that USER is just a place holder.

> Can someone suggest the way I should be using the USER value in this
> instance?

You could use dynamic SQL. Then again, if you are on SQL 2000 you could
just say

DROP TABLE tblEducation_SAP1

since the default schema for a user always agrees with the name of the
user. (This is a little different on SQL 2005 where users and schema
are separate.)


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация