|
I have an application which has two database connections with two different logical databases (with different DSNs). Can I work with the sane SQL_HANDLE_ENV for both the connections, or do I need to create a new SQL_HANDLE_ENV for every logical database? Please help me.
|
|
|
|
|
Hi all im using SqlServer2005.. I need to insert multiple rows into a existing table(db1) from other database(db2).. There are around 400 rows(15 columns) need to be inserted. Both db are having same tables. how can i do it..
Thanks...
modified on Wednesday, September 22, 2010 5:34 AM
|
|
|
|
|
Which database?
test-09 wrote: other database(db2)
Database/table?
|
|
|
|
|
|
insert into table1 (columname1,columnname2) <br />
select columnmae1,columname2 from databasename.dbo.table2
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
www.aktualiteti.com
|
|
|
|
|
For all 400 rows i need to write the statements?? or any other way..
test09
|
|
|
|
|
That is basic query with which you can import records between tables but in select query it depends on your criterias.
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
www.aktualiteti.com
|
|
|
|
|
I am having the same db with 2 back ups both have different information(table rows) i need to append both..
test09
|
|
|
|
|
Did you try that query?
I think you are trying to merge two databases into one, right?
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
www.aktualiteti.com
|
|
|
|
|
yes but i need to merge only one table..
test09
|
|
|
|
|
Then use my query and all will be done.
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
www.aktualiteti.com
|
|
|
|
|
using that query can insert single row how do i select all 400 rows.. or else i need to execute that query for each and every row..
test09
|
|
|
|
|
That query will insert all rows from table, not only one!
Better check this http://en.wikipedia.org/wiki/Insert_(SQL)
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
www.aktualiteti.com
|
|
|
|
|
He's in trouble if he is trying to merge 2 tables, there will be duplicates unless he filters them out.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I warned him/her too in previos post, thanks for claryfing me
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
www.aktualiteti.com
|
|
|
|
|
Actually I think I could have left it a he's in trouble
His level of understanding about database needs upgrading
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Take the boys query and add a where clause that filters out existing records so you do not get duplicates. You need to identify the primary key (unique data) in both fields that can be used to apply the filter.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi,
I write MSSQL queries to retrieve unicode data. It shows data in result Grid like boxes it cannot be readable format, What to do if unicode character should be displayed in readable format in MSSQL result grid....
************ S G KORE *******************
|
|
|
|
|
I think it has something to do with the characters sets installed under windows. I know we have chinese installed and the unicode display Ok but japanese is just boxes.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi,
I have a unique id column in a table with values -
12
32
45
345
3534
45456
etc.
Now i want to make all the values to be 7 digit by placing 0's in front of each id for example above ids will be
0000012
0000032
0000045
0000345
0003534
0045456
Now there are 1000's of values that i need to change - what would be the best possible way to write query for this.
Thanks
|
|
|
|
|
|
That would only work if they're string values, which they shouldn't be. You could left pad them when you display them.
|
|
|
|
|
yeh they are int values. Anyway to do it for int ?
thanks
|
|
|
|
|
AndyInUK wrote: yeh they are int values. Anyway to do it for int ?
Why would you want to? The following values are all the same:
1
01
001
0001
Generally, you'll apply padding purely for display/writing to file purposes, and this should be accomplished in the client code - not in the database.
|
|
|
|
|
yes they mean same but when we try to sort its meaning will change thats y for sorting we need this
|
|
|
|