|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
pull table SchemaHi all,
Is there a quick way to pull table Schema of a table? Like to see the name, datatype, size thanks gv EXEC sp_help tablename
Show quote "gv" <viator.ge***@gmail.com> wrote in message news:uDAtwM10GHA.4116@TK2MSFTNGP02.phx.gbl... > Hi all, > > Is there a quick way to pull table Schema of a table? > > Like to see the name, datatype, size > > thanks > gv > Thanks for your help!!
I'm trying to pull information on a temp table like so and get a error message EXEC sp_help tempdb..##tmp_FOC thanks gv Show quote "Aaron Bertrand [SQL Server MVP]" <ten.xoc@dnartreb.noraa> wrote in message news:%23JSDoO10GHA.3752@TK2MSFTNGP02.phx.gbl... > EXEC sp_help tablename > > > "gv" <viator.ge***@gmail.com> wrote in message > news:uDAtwM10GHA.4116@TK2MSFTNGP02.phx.gbl... >> Hi all, >> >> Is there a quick way to pull table Schema of a table? >> >> Like to see the name, datatype, size >> >> thanks >> gv >> > > Usually it helps tremendously if you can be more specific than "get a error
message." The reason you get an error message and not just a big yellow exclamation point is so that you can you use the text of the error message to troubleshoot, research, or pass along to people who are trying to help you. Anyway, in this case we're lucky that it is obvious what error message you get: Server: Msg 15250, Level 16, State 1, Procedure sp_help, Line 52 The database name component of the object qualifier must be the name of the current database. You can't pass fully-qualified objects into local sp_help, since sp_help will try to execute in the current database and does not how to recurse up. You need to execute the procedure in the database where the object lives, and only pass in the object name. EXEC tempdb.dbo.sp_help '##tmp_FOC'; Any reason you're using a global temp table? I know they're available, so they must be useful to someone, but I have yet to find a practical application for them. A Show quote "gv" <viator.ge***@gmail.com> wrote in message news:e%23GJ1T10GHA.3716@TK2MSFTNGP03.phx.gbl... > Thanks for your help!! > > I'm trying to pull information on a temp table like so and get a error > message > > EXEC sp_help tempdb..##tmp_FOC > > thanks > gv sorry,
Actually I'm not using them I'm trying to replace with a table variable. I have alot of stored procedures with alot of temp tables in them and I'm trying to go through and easily pull the column names and datatype \ size so I can easly create the Create statemeant. Trying to save alot of tedious time. I'm just copying the exsisting sp in query analyzer and rewritting it there for easy testing. the error: Server: Msg 170, Level 15, State 1, Line 129 Line 129: Incorrect syntax near '.'. thanks gv Show quote "Aaron Bertrand [SQL Server MVP]" <ten.xoc@dnartreb.noraa> wrote in message news:OA5UbY10GHA.4188@TK2MSFTNGP04.phx.gbl... > Usually it helps tremendously if you can be more specific than "get a > error message." The reason you get an error message and not just a big > yellow exclamation point is so that you can you use the text of the error > message to troubleshoot, research, or pass along to people who are trying > to help you. > > Anyway, in this case we're lucky that it is obvious what error message you > get: > > Server: Msg 15250, Level 16, State 1, Procedure sp_help, Line 52 > The database name component of the object qualifier must be the name of > the current database. > > You can't pass fully-qualified objects into local sp_help, since sp_help > will try to execute in the current database and does not how to recurse > up. > > You need to execute the procedure in the database where the object lives, > and only pass in the object name. > > EXEC tempdb.dbo.sp_help '##tmp_FOC'; > > Any reason you're using a global temp table? I know they're available, so > they must be useful to someone, but I have yet to find a practical > application for them. > > A > > > > "gv" <viator.ge***@gmail.com> wrote in message > news:e%23GJ1T10GHA.3716@TK2MSFTNGP03.phx.gbl... >> Thanks for your help!! >> >> I'm trying to pull information on a temp table like so and get a error >> message >> >> EXEC sp_help tempdb..##tmp_FOC >> >> thanks >> gv > > |
|||||||||||||||||||||||