I'm using SMS 2008 & I'm looking for where the registered servers are stores on my local machine. I have searched the registry with no luck.
AHIA,
Larry...
I have a simple query over a table, which returns results like the following:
id id_type id_ref
2702 5 31
2702 16 14
2702 17 3
2702 40 1
2702 26 4
And I would like to merge the results into a single row, for instance:
id concatenation
2702 5,16,17,40,26:31,14,3,1,4
Is there any way to do this within a trigger?
NB: I know I can use a cursor, but I would really prefer not to unless there is no better way.
I have group of stored procedures with names like 'somename_%'. Are there any way to delete that SP with one query, forexample
DROP PROCEDURE where name like
'somename_%'
.
Is it possible to provide the following type of fuctionality with informix client tools?
As the user types the first two characters of a name, the drop-down list is empty. At the third character, the list fills with just the names beginning with those three characters. At the fourth character, MS-Access completes the first matching name (assuming the combo's AutoExpand is on). Once enough characters are typed to identify the customer, the user tabs to the next field.
The time taken to load the combo between keystrokes is minimal. This occurs once only for each entry, unless the user backspaces through the first three characters again.
If your list still contains too many records, you can reduce them by another order of magnitude by changing the value of constant conSuburbMin from 3 to 4.
I am stuck in converting this snipped to asp.net.
set RSLinksCat = conn.Execute("select linkscat.id, linkscat.category from linkscat, contentlinks, links where contentlinks.linksid = links.id and contentlinks.contentid = " & contentid & " and links.linkscatid = linkscat.id order by linkscat.category")
<%if not RSLinksCat.EOF then%><h1>Links</h1>
<br />
<%do while not RSLinksCat.EOF%>
<%set RSLinks = conn.Execute("select * from links where linkscatid = " & RSLinksCat("id") & "")%>
<strong><%=RSlinkscat("category")%><strong>
<ul>
<%do while not RSlinks.EOF%>
<li>
<a href = "http://<%=RSLinks("url")%>" target="_blank"><%=RSlinks("description")%></a>
</li>
<%RSLinks.MoveNext
loop%>
</ul>
<%RSLinksCat.MoveNext
loop%>
<br />
<%end if%><%conn.close%>
I'm not sure where to start. Can anyone recommend the correct approach i.e sqldatareaders or repeaters or arrays or? VB code samples most welcome.
Thanks
I'm looking for a Java ORM that works from database reflection - I need to just point it at a DB, and start being able to walk through the entire set of tables, etc.
Ideas?
I have a varchar @a='a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p' , wich have | delimitted values. I want to split this variable in a array or a table.
Do anyone have any idea about this.
If you have a table with a clustered index on the Primary Key (int), is it redundant and bad to have one (ore more) non-clustered indexes that include that primary key column as one of the columns in the non-clustered index?
Hi All,
I'd like to move some data from one table to another (with a possibly different schema). Straightforward solution that comes into mind is -
start a transaction with serializable isolation level;
INSERT INTO dest_table SELECT data FROM orig_table,other-tables WHERE <condition>;
DELETE FROM orig_table USING other-tables WHERE <condition>;
COMMIT;
Now what if the amount of data is rather big, and the <condition> is expensive to compute? In PostgreSQL, a RULE or a stored procedure can be used to delete data on the fly, evaluating condition only once. Which solution is better? Are there other options?
hi!
the query is:
select employee_id, last_name, salary, round((salary+(salary*0.15)), 0) as
NewSalary, (round((salary+(salary*0.15)), 0) - salary) as “IncreaseAmount”
from employees;
can i optimize this round((salary+(salary*0.15)), 0) part in anyway, so that it doesn't appear twice..i tried giving it an alias but didn't work :(
I'm using a database link to execute a DELETE statement on another DB, but the DB link name doesn't conform to global naming, and this requirement cannot change.
Also I have global_names set to false, and cannot be changed either.
When I try to use these links however, I receive:
ORA-02069: - global_names parameter must be set to TRUE for this operation
Cause: A remote mapping of the statement is required but cannot be achieved because
GLOBAL_NAMES should be set to TRUE for it to be achieved. -
Action: Issue `ALTER SESSION SET GLOBAL_NAMES = TRUE` (if possible)
What is the alternative action when setting global_names=true is not possible?
Cheers,
Jean
At my job, we have pseudo-standard of creating one table to hold the "standard" information for an entity, and a second table, named like 'TableNameDetails', which holds optional data elements. On average, for every row in the main table will have about 8-10 detail rows in it.
My question is: What kind of performance impacts does this have over adding these details as additional nullable columns on the main table?
I'm trying to make a table visible to Views. One of the columns has type date (as opposed to a Unix timestamp). The example I initially tried to copy from is in modules/comment.views.inc in the Views module:
// timestamp (when comment was posted)
$data['comments']['timestamp'] = array(
'title' => t('Post date'),
'help' => t('Date and time of when the comment was posted.'),
'field' => array(
'handler' => 'views_handler_field_date',
'click sortable' => TRUE,
),
'sort' => array(
'handler' => 'views_handler_sort_date',
),
'filter' => array(
'handler' => 'views_handler_filter_date',
),
);
This makes the dates, which are all in the past year or so, show up as "1 Jan 1970 00:33", so evidently a value of '2010-05-12', for example, is being interpreted as 2010 seconds past 1 Jan 1970 00:00.
Can anyone point me to a correct way of exporting date columns?
EDIT: I'm following up on some clues found at http://drupal.org/node/476774 .
I was trying to run the following query
UPDATE blog_post SET `thumbnail_present`=0, `thumbnail_size`=0, `thumbnail_data`=''
WHERE `blog_post` NOT IN (
SELECT `blog_post`
FROM blog_post
ORDER BY `blog_post` DESC
LIMIT 10)
But Mysql doesn't allow 'LIMIT' in an 'IN' subquery.
I think I can make a select to count the table rows and then make an ordered update limited by 'COUNT - 10', but I was wondering if there is a better way.
Thanks in advance.
I'd like to change
{foo, {bar}, foobar}
to
{foo, bar, foobar}
in all rows that match '{.*{'. I.e. remove all curly braces { and } except the outer most pair.
So doing
mysql -h $H -u $U -p$P $DB -B -e "SELECT id FROM t WHERE col REGEXP '{.*{'" > bad.txt
selects all the rows that will need this substitution. How do I make this substitution very quickly?
EDIT:
Could I do it by
update table set column = REPLACE(column,'{','');
Then restore the out most pair
update table set column = REPLACE(column,'^','{');
update table set column = REPLACE(column,'$','}');
How do you guys maintain your stored procedures? I'd like to keep versions of them for a few different reasons.
I also will be setting up cruisecontrol.net and nant this weekend to automate builds.
I was thinking about coding something that would generate the create scripts for all tables/sprocs/udf/xml schemas in my development database. Then it would take those scripts and update them in source control every couple hours.... Ideally, I'd like to make this some sort of plugin/module for cruisecontrol.net.
Any other ideas?
My table looks like this with duplicates in col1
col1, col2, col3, col4
1, 1, 0, a
1, 2, 1, a
1, 3, 1, a
2, 4, 1, b
3, 5, 0, c
I want to select distinct col1 with max (col3) and min(col2);
so result set will be:
col1, col2, col3, col4
1, 2, 1, a
2, 4, 1, b
3, 5, 0, c
I have a solution but looking for best ideas?
Hi friends,
While updating a datatime column in a table from another table, i noticed that mnilliseconds value are not shown.. instead it is rounded and the value is updated to nearest seconds.
Example :
Original Value: 2008-06-26 14:06:36.643
Updated Value : 2008-06-26 14:07:00
Please help me getting the actual value including milliseconds
i created a small application using c# winforms that uses mssql as a database.
is there a way to attach the database to the exe file so i won't need to install sqlserver on all the machines that i want to run the program on?
I new to OLAP, and still not sure how to create a relationship between 2 or more entities.
I am basing my cube on views. For simplicity sake let's call them like this:
viewParent (ParentID PK)
viewChild (ChildID PK, ParentID FK)
these views have more fields, but they're not important for this question.
in my data source, i defined a relationship between viewParent and viewChild using ParentID for the link.
As for measures, i was forced to create separate measures for Parent and Child.
in my MDX query however, the relationship does not seem to be enforced. If i select record count for parent, child, and add some filters for the parent, the child count is not reflecting it..
SELECT {
[Measures].[ParentCount],[Measures].[ChildCount]
} ON COLUMNS
FROM [Cube]
WHERE {
(
{[Time].[Month].&[2011-06-01T00:00:00]}
,{[SomeDimension].&[Foo]}
)
}
the selected ParentCount is correct, but ChildCount is not affected by any of the filters (because they are parent filters). However, since i defined a relationship, how can i take advantage of that to filter children by parent filter?
I have a column whose value is a json array. For example:
[{"att1": "1", "att2": "2"}, {"att1": "3", "att2": "4"}, {"att1": "5", "att2": "6"}]
What i would like is to provide a view where each element of the json array is transformed into a row and the attributes of each json object into columns. Keep in mind that the json array doesn't have a fixed size.
Any ideas on how i can achieve this ?
The situation is as follows:
I have a substantial number of tables, with each a substantial number of columns. I need to deal with this old and to-be-deprecated database for a new system, and I'm looking for a way to eliminate all columns that have - apparently - never been in use.
I wanna do this by filtering out all columns that have a value on any given row, leaving me with a set of columns where the value is NULL in all rows. Of course I could manually sort every column descending, but that'd take too long as I'm dealing with loads of tables and columns. I estimate it to be 400 tables with up to 50 (!) columns per table.
Is there any way I can get this information from the information_schema?
EDIT:
Here's an example:
column_a column_b column_c column_d
NULL NULL NULL 1
NULL 1 NULL 1
NULL 1 NULL NULL
NULL NULL NULL NULL
The output should be 'column_a' and 'column_c', for being the only columns without any filled in values.
Hey all
i have 3 tables each as follow
cash_credit
Bank_Name-------in_date-------Com_Id---Amount
America Bank 15/05/2010 1 200
HSBC 17/05/2010 3 500
Cheque_credit
Bank_Name-----Cheque_Number-----in_date-------Com_Id---Amount
America Bank 74835435-5435 15/05/2010 2 600
HSBC 41415454-2851 17/05/2010 5 100
Companies
com_id----Com_Name
1 Ebay
2 Google
3 Facebook
4 Amazon
Companies table is a linked table when i tried to create an query as follow
SELECT cash_credit.Amount, Companies.Com_Name, cheque_credit.Amount
FROM cheque_credit INNER JOIN (cash_credit INNER JOIN Companies ON cash_credit.com_id = Companies.com_id) ON cheque_credit.com_id = Companies.com_id;
I get an error saying that my inner Join is incorrectly, this query was created using Access 2007 query design
the error is
Type mismatch in expression
then i thought it might be the inner join so i tried Left Join and i get an error that this method is not used
JOIN expression is not supported
I am confused on where is the problem that is causing all this
Hi...
I've got an entity object - Customer, with a property called VATRate.
This VATRate is in the form of a decimal (0.25). I wanted to be able to enter a percentage value, and save it in the correct decimal value in the database, so I made this custom property:
partial class Customer{
public decimal VatPercent {
get{ ... //Get code works fine}
set {
this.VATRate = (value / 100);
}
}
}
And then I just bind this property instead of VATRate in my ASPX editTemplate (formview).
This actually works - at least one time, when I debug an update, the value is set correctly one time, and then right after it gets set to the old value. I can't really see why it sets the value twice (and with the old value the second time).
Can anyone shed some light on this?