|
Hi
I have one GridView and in this gv i have two column one is mark-printer other is model-printer.So i done this column like template but i don't know how to do exchanging of data when i doing edit???I mean if i choos for example "HP" i want to see only models for hp not all how to link both controls pleas help me.
Good bye best regards
|
|
|
|
|
I have a function which is used as a default in a number of tables/columns.
I want to alter that function but when I do an "ALTER FUNCTION..." bit of SQL it tells me it can't be altered because it is in use - does anyone have a handy "drop all the defaults, alter function, reinstate all the defaults" type script I could cadge?
'--8<------------------------
Ex Datis:
Duncan Jones
Merrion Computing Ltd
|
|
|
|
|
<br />
create table tempdb..DEJ_Constraints<br />
(<br />
table_name sysname,<br />
constraint_name sysname,<br />
constraint_text varchar(1000),<br />
column_name sysname<br />
)<br />
go<br />
<br />
<br />
insert into tempdb..DEJ_Constraints<br />
select object_name(sysconstraints.id) as table_name,<br />
object_name(sysconstraints.constid) as constraint_name,<br />
syscomments.text as constraint_text,<br />
syscolumns.name as column_name<br />
from (syscomments inner join sysconstraints on<br />
syscomments.id = sysconstraints.constid) INNER JOIN syscolumns<br />
on syscolumns.id = sysconstraints.id <br />
and syscolumns.colid = sysconstraints.colid<br />
where syscomments.text like '%GetNextkey%'<br />
go<br />
<br />
-- Drop any existing constraints that use the function...<br />
declare @table_name sysname,<br />
@constraint_name sysname,<br />
@command varchar(1000)<br />
<br />
declare constraint_killer cursor for<br />
select table_name, constraint_name <br />
from tempdb..DEJ_Constraints<br />
<br />
open constraint_killer <br />
<br />
<br />
FETCH NEXT FROM constraint_killer INTO @table_name , @constraint_name<br />
<br />
WHILE @@FETCH_STATUS = 0<br />
BEGIN<br />
SELECT @COMMAND = 'ALTER TABLE ' + @table_name + ' DROP CONSTRAINT ' + @constraint_name<br />
<br />
EXECUTE(@COMMAND)<br />
<br />
print 'Executed : ' + @command <br />
<br />
FETCH NEXT FROM constraint_killer INTO @table_name , @constraint_name<br />
END<br />
<br />
close constraint_killer <br />
<br />
deallocate constraint_killer <br />
go<br />
then alter the function then..
<br />
declare @table_name sysname,<br />
@constraint_name sysname,<br />
@column_name sysname,<br />
@constraint_text varchar(1000),<br />
@command varchar(1000)<br />
<br />
declare constraint_builder cursor for<br />
select table_name, constraint_name , constraint_text, column_name<br />
from tempdb..DEJ_Constraints<br />
<br />
open constraint_builder <br />
<br />
<br />
FETCH NEXT FROM constraint_builder INTO @table_name , @constraint_name, @constraint_text ,@column_name <br />
<br />
WHILE @@FETCH_STATUS = 0<br />
BEGIN<br />
SELECT @COMMAND = 'ALTER TABLE ' + @table_name + ' ADD CONSTRAINT ' + @constraint_name + ' DEFAULT ' + @constraint_text + ' FOR ' + @column_name <br />
<br />
EXECUTE(@COMMAND)<br />
<br />
print 'Executed : ' + @command <br />
<br />
FETCH NEXT FROM constraint_builder INTO @table_name , @constraint_name, @constraint_text , @column_name <br />
END<br />
<br />
close constraint_builder <br />
<br />
deallocate constraint_builder <br />
go<br />
<br />
drop table tempdb..DEJ_Constraints<br />
go<br />
'--8<------------------------
Ex Datis:
Duncan Jones
Merrion Computing Ltd
|
|
|
|
|
I need a count column and 2 other columns in the select query. Consider the following query:
select locid,lname,count(deviceid) AS count<br />
from failures<br />
group by locid
The above query will not work because Column 'LName' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
How can i get both the locid and lname?
Thanks
-- modified at 12:17 Wednesday 19th April, 2006
|
|
|
|
|
dansoft wrote: How can i get both the locid and lname?
Add both columns to the GROUP BY clause.
GROUP BY locid, lname
"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
|
|
|
|
|
thanks working
|
|
|
|
|
The following sql join query is displaying "[Microsoft][ODBC SQL Server Driver]Syntax error or access violation" error
SELECT failure.locid,device.count,failure.count<br />
FROM<br />
{<br />
SELECT locality.locid,count(*) AS count<br />
FROM allotment,locality<br />
WHERE allotment.locid=locality.locid<br />
group by locality.locid<br />
} AS device<br />
FULL OUTER JOIN<br />
{<br />
SELECT locid,count(deviceid) AS count<br />
FROM failures<br />
group by locid<br />
} AS failure ON device.locid = failure.locid
device is used to find number of device in a particular locality
failure is to find the number of failures in the particular location
Both device and failure queries are working fine separately.
All localities are stored in locality table. the alloted devices are in allotment table, failures are in failures table
Please correct the error in the query. Thanks.
|
|
|
|
|
dansoft wrote: {
I've never seen that type of bracket/brace used in SQL. Use the normal brackets ()
"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
|
|
|
|
|
Colin Angus Mackay wrote: Use the normal brackets ()
Sir, where i have to use the normal brackets () ?
|
|
|
|
|
Oh Sorry, i'll change the bracket.
Thanks
|
|
|
|
|
dansoft wrote: Sir, where i have to use the normal brackets () ?
Where do you think?
I highlighted the fact you were using braces {} and that it was wrong. Replace the {} with ()
"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
|
|
|
|
|
Hi,
Does Anyone know how to change the size of LEGEND Box in any chart of RDL File? There are many details in LEGEND area of my chart which makes legend area much congested.
Thanks in Advance
|
|
|
|
|
Hi,
why the select query is not returning the decimal value?
consider the following query:
select 1/2
it is returning 0
it must return 0.5 Please help.
Thanks
|
|
|
|
|
Because it is doing an integer division and truncating everything past the decimal point.
use SELECT 1.0/2.0
"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
|
|
|
|
|
I need to use the colname. for eg: select colname1/colname2 from table
the colname1 has the value 1 & colname2 has the value 2
thanks
|
|
|
|
|
Then cast the column values to float s
SELECT CAST(colname1 AS FLOAT) / CAST(colname2 AS FLOAT) FROM MyTable
"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
|
|
|
|
|
Colin Angus Mackay wrote: SELECT CAST(colname1 AS FLOAT) / CAST(colname2 AS FLOAT) FROM MyTable
Thanks
It is working
|
|
|
|
|
Hi,
I want to delete Duplicate rows from the table
Thanking you.....
Balu
|
|
|
|
|
What is the structure of your table? (i.e. field names and data types)
----------
There go my people. I must find out where they are going so I can lead them.
- Alexander Ledru-Rollin
|
|
|
|
|
|
Hi
I have an Database in SQLServer in that i have no. of tables with primary key's and forign key's
I want to see the Script of the databse in
SQLServer Enterprice manager
Is it posible to see the whole (1 database)database scripts
Like "CASE Studio 2"
asdfasdfasdfasdfasdfasdfasdfasdfasdfasdf
|
|
|
|
|
hi,
I have a table like
saleno Itemname Qty
1 M.board 10
2 Mouse 20
3 Keyboard 20
4 H.disk 30
5 Monitor 40
after the Update Query i want the result(just add qty with above Qty value in base table)
saleno Itemname Qty
1 M.board 10
2 Mouse 30
3 Keyboard 40
4 H.disk 50
5 Monitor 70
Thank you fro your reply
Balu
|
|
|
|
|
Sorry, I don't understand what you want.
To update a row in a table you can use
UPDATE MyTable SET Qty = 70 WHERE saleno = 5
"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
|
|
|
|
|
Hi Balu,
Here's your reply.
If you have a proper sequence with no missing links use the following:
Select a.saleno,b.saleno, coalesce(a.qty,0)+coalesce(b.qty,0) as Qty
from tbl_Sale a left join tbl_sale b
ON a.saleno=b.saleno+1
Else use the following:-
Select a.saleno,coalesce(a.qty,0)+COALESCE((Select b.Qty from tbl_Sale b where b.saleno=
(Select max(c.saleno) from tbl_sale c where c.saleno
|
|
|
|
|
Oh! I see what he was getting at now. I really do wish people would say what they want rather than have everyone guess what they want through some cryptic IQ test what-is-the-next-number-in-the-sequence style question.
"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 5:22 Wednesday 19th April, 2006
|
|
|
|