Is it possible to create tables in stored procedures using
a variable for the table name?
Answers were Sorted based on User's Feedback
Answer / skybeaver
create proc ShowMeHow
as
declare @Cities table(
AirportCode char(3) not null primary key,
CityName varchar(255) not null
)
insert into @Cities values('LAX', 'Los Angeles')
insert into @Cities values('ORD', 'Chicago')
select * from @Cities
go
| Is This Answer Correct ? | 7 Yes | 1 No |
Answer / pradeep
One Can create Table using a variable. As #1 Answer
describe. You can only create a temp (memory) table but can
not create physical table.
It will give an error while attempting to execute : -
Create Table @VariableName( EmpID varchar(10),
EmpNm Varchar(100)
)
| Is This Answer Correct ? | 1 Yes | 0 No |
You have to store user responses of ‘yes’ and ‘no’ what kind of data type is best suited for this task?
How to swap the data of two columns in a table. both the columns containing varchar values.
Can we use trigger new in before insert?
What is a Linked Server?
how to find number of columns in a table in sql server 2000 and 2005 also
If we use where clause in the left outer join then how the query would behave/act?
How can a database be repaired?
How many levels of sp nesting are possible?
Who is the owner of a schema in ms sql server?
What are the methods used to protect against sql injection attack?
What are the triggers in sql?
You are designing a database for your human resources department in the employee table, there is a field for social security number, which cannot contain null values if no value is given, you want a value of unknown to be inserted in this field what is the best approach?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)