|
yes u are right , it makes no difference.
But still i want to know how can i do that ???
If any body knows ?
|
|
|
|
|
Ok, given that, you made me interested in how...
Try this[^].
|
|
|
|
|
it was all about swaping existing columns.
columns can be added at desired place using enterprises manager but i m tryng to do it using alter table or ..... some thin that i dont know.
sanjeev
|
|
|
|
|
I think if you read it through, they were saying that behind the scenes enterprise manager copies all your data into a temp table, drops the current table, then recreates it with your new table order and copies the data back over.
Dead easy...
|
|
|
|
|
thanks for your reply.
but you r not geting wat i mean to say ?
|
|
|
|
|
No, you want a simple way within an alter statement to place a column at a particular index within a table. What i'm saying to you here, is that there isn't a simple alter table predicate...
Why would enterprise manager go through the whole copy/drop/recreate routine for moving a column (as it all has to be done through t-sql), if there was a simple way to do it using the alter statement...?
|
|
|
|
|
thanks a lot for taking interest in my doubt.
so the answer is no , i cant do it.
sanjeev
|
|
|
|
|
Well, you can do it, but you'll have to write a script to do the copy/drop/recreate routine.
|
|
|
|
|
It can be done, but it isn't pretty.
Whenever there is a way to do something in the Enterprise Manager, and I want to know the TSQL, I just:
1) turn on the SQL Profiler
2) do my thing in Enterprise Manager
3) turn off the SQL Profiler
4) look for the lines that did what I want to know how to do
5) copy them into SQL Query Analyzer
6) tweak it to my heart's content
--create a table with three columns
CREATE TABLE dbo.tblMyTable
(
Col1 int NOT NULL,
Col2 varchar(50) NULL,
Col3 int NULL
) ON [PRIMARY]
CREATE TABLE dbo.Tmp_tblMyTable
(
Col1 int NOT NULL,
InsertedCol int NULL,
Col2 varchar(50) NULL,
Col3 int NULL
) ON [PRIMARY]
--Take all the data from the old table, and put it in the new one
INSERT INTO dbo.Tmp_tblMyTable (Col1, Col2, Col3)
SELECT Col1, Col2, Col3 FROM dbo.tblMyTable
DROP TABLE dbo.tblMyTable --drop the old table
EXECUTE sp_rename 'dbo.Tmp_tblMyTable', 'tblMyTable' --rename new one
ALTER TABLE dbo.tblMyTable ADD CONSTRAINT
PK_tblMyTable PRIMARY KEY CLUSTERED
(
Col1
) ON [PRIMARY]
----------
There go my people. I must find out where they are going so I can lead them.
- Alexander Ledru-Rollin
|
|
|
|
|
|
How to use the currency manager please?? I am trying to make new record with the currency manager. I have a relational database and I want to make new records with the currency manager. How can i use it please. i am not using any array. i want to make position + 1 as well with it! how can i use it please??
Adrian De Battista: .Net Programmer, Java Programmer and Web Designer.
|
|
|
|
|
rfebin2001 wrote: But i want to pass the error to the DAL Factory Class and we throw as a errror
I don't quite understand how you would do that. The DAL Factory class would instantial a DAL object and it would be your DAL object that communicates with the database. The DAL Factory Class' sole purpose in life should just be to construc DAL objects. If it does anything else then its responsibility is overloaded.
I'll assume for the rest that you meant DAL class/object
rfebin2001 wrote: that is the SQL exception error plus our company's validation engine error
When you create a class derived from Exception[^] there are a number of constructors[^] that you can override. One of them[^] accepts a message (which your validator engine can produce) and another Exception object. This will be exposed as the InnerException of the Exception that is being thrown.
Is this what you are looking for?
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
-- modified at 7:20 Wednesday 17th May, 2006
|
|
|
|
|
how will get last affectecd row in a table
if u using @@identity it is working in SP
Without using SP or any
while we insert as a sql command as a string, and use executenonquery method will executed
this scenario how will get the last affected row from a table
thanx
-
|
|
|
|
|
This will still work whether you are using a stored procedure or not. Try it in Query Analyzer and see.
rfebin2001 wrote: while we insert as a sql command as a string, and use executenonquery method will executed
this scenario how will get the last affected row from a table
I don't understand. Do you mean you want to get value from @@IDENTITY returned to the .NET code that executed the SQL?
You could use SELECT @@IDENTITY and call ExecuteScalar() in the .NET code.
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
Without using any extra query, or SP how will get the last affected row in that table
-
|
|
|
|
|
NICE TO MEET wrote: Without using any extra query, or SP how will get the last affected row in that table
What is the different to your .NET application by putting two queries into one SqlCommand object? Or adding to the stored procedure the SELECT @@IDENTITY ?
cmd.CommandText = "INSERT MyTable(Column1, Column2) VALUES ('ABC', 'DEF'); SELECT @@IDENTITY;";
int primaryKey = (int)cmd.ExecuteScalar();
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
How much the maximum size of XML we can pass to SQL Server to do the transact SQL Operations
Tell me Pls
thanx
-
|
|
|
|
|
Hi
My table has composite pk, when i want to select based on one key i write
select * from table where col1 = 'val1' and col2 = 'val2'
when i have more then one pk like (val1, val2), (val3, val4), ...
how can i write select with in so that i can get rows satisfing all the conditions.
Shajeel
|
|
|
|
|
select * from table where col1 in ('val1', 'val2') and col2 in ('val3', 'val4')
|
|
|
|
|
if will give me four combinations
val1 and val3
val1 and val4
val2 and val3
val2 and val4
but i want only two combinations like here i just want first and third condition.
Shajeel
|
|
|
|
|
you put dummy data in table then check the query will work fine...
|
|
|
|
|
suppose i have a table
Color Shape
Red Cirle
Red Square
Yellow Square
and i want 2 records of (Red, Circle) and (Yellow, Square)
your command will return me 3 records out of which i dont want middle one.
Thank for taking interest
Shajeel
|
|
|
|
|
you can simply use:
<br />
select * from table <br />
where col1 IN('val1' , 'val2') and col2 IN ('val3' , 'val4')<br />
it will work...
Javed
|
|
|
|
|
Now i have an Xml like this
11<Root>
11 <Element>
11 <Table1 Value as XML attributes/>
11 </Element>
11 <Element>
11 <Table2 Value as XML attributes/>
11 </Element>
11 <Element>
11 <Table3 Value as XML attributes/>
11 </Element>
11 <Element>
11 <Table1 Value as XML attributes/>
11 </Element>
11 <Element>
11 <Table2 Value as XML attributes/>
11 </Element>
11 <Element>
11 <Table3 Value as XML attributes/>
11 </Element>
11 <Element>
11 <Table1 Value as XML attributes/>
11 </Element>
11 <Element>
11 <Table2 Value as XML attributes/>
11 </Element>
11 <Element>
11 <Table3 Value as XML attributes/>
11 </Element>
11 <Element>
11 <Table1 Value as XML attributes/>
11 </Element>
11 <Element>
11 <Table2 Value as XML attributes/>
11 </Element>
11 <Element>
11 <Table3 Value as XML attributes/>
11 </Element>
11</Root>
The above xml having 3 different table values in 4 set of nodes to update 3 tables by using open XML
How will u achieve this target
The above XML nodes are stable in all times as 3 elements
//////
Is it possible to change as 4 elements and update to 4 tables at run time
This second scenario how will the stored procedure will update the 4th table
The stored procedure is created for first scenario to update 3 tables
Can i possible to achieve my second target by the same procedure
Tell me the suggestions
thanx
-
|
|
|
|
|
Can u guide me to do a bulk update into more than one table from getting a single xml ine the form of attribute centric and element centric mapping, Tell the procedure to create the stored procedure itself, now i am having XML as a string to update a table
Reply with Source Pls
Thanks
-
|
|
|
|