Hi,
i have a problem that I want to resolve in a best possible way. The thing is that I made a schema that looks like this:
print("
<xs:complexType name="rentACarT">
<xs:sequence>
<xs:element name="poslovnice" type="poslovniceT" />
<xs:element name="korisnici" type="korisniciT" />
</xs:sequence>
</xs:complexType>
<xs:...
I have a sql query that takes a date parameter (if I were to throw it into a function) and I need to run it on every day of the last year.
Does anyone know of an easy way to generate a list of the last 365 days so I can use straight-up sql to do this?
Obviously generating a list 0..364 would work too since I could always
select SYSDA...
I'm setting up Fact and Dim tables and trying to figure out the best way to setup my time values. AdventureworksDW uses a timekey (UID) for each time entry in the DimTime table. I'm wondering there's any reason I shouldn't just use a time value instead i.e. 0106090800 (My granularity is hourly)?
...
http://en.wikipedia.org/wiki/Upsert
http://stackoverflow.com/questions/13540/insert-update-stored-proc-on-sql-server
Is there some clever way to do this in SQLite that I have not thought of?
Basically I want to update three out of four columns if the record exists
If it does not exists I want to INSERT the record with the default (NU...
MS Access has limited capabilities to manage raw SQL queries: the editor is quite bad, no syntax highlighting, it reformats your raw SQL into a long string and you can't insert comments.
Debugging complex SQL queries is a pain as well: either you have to split it into many smaller queries that become difficult to manage when your schema...
Hello
I am the lead developer on a commercial Windows app (c#). A new requirement is to track customers who abuse the license.
For example: Let's say a customer purchases a 10 user license agreement, i.e. 10 simultaneous users at any given time.
I need to be able to report, looking back at history, all the times that customer had mor...
What's difference between inner join and outer join (left join,right join), and which has the best performance of them?
Thanks!
...
Hi,
I asked the opposite question here, now I am faced with another problem. Assume I have the following tables (as per poster in previous post)
CustID LastName FirstName
------ -------- ---------
1 Woman Test
2 Man Test
ProdID ProdName
------ --------
123 NY Times
234 Boston Globe
ProdID IssueID PublishDate
...
I have a Sql statament using special character (ex: ('), (/), (&)) and I don't know how to write them in my VB.NET code. Please help me. Thanks.
...
[This is on an iSeries/DB2 database if that makes any difference]
I want to write a procedure to identify columns that are left as blank or zero (given a list of tables).
Assuming I can pull out table and column definitions from the central system tables, how should I check the above condition? My first guess is for each column generat...
I'm looking at creating a basic ORM (purely for fun), and was wondering, is there a way to return the list of tables in a database and also the fields for every table?
Using this, I want to be able to loop through the result set (in C#) and then say for each table in the result set, do this (e.g. use reflection to make a class that will...
Is there a way to hide/protect/obfuscate MS SQL Stored Procedures?
...
What is the lowest permission level I need on a user to be able to create diagrams in SQL Server Enterprise Manager?
I'm currently set as data reader and I am unable to create diagrams. (I wouldn't expect to be able to at this permission level)
...
I recently started working at a company with an enormous "enterprisey" application. At my last job, I designed the database, but here we have a whole Database Architecture department that I'm not part of.
One of the stranger things in their database is that they have a bunch of views which, instead of having the user provide the date r...
I have an SQL Server 2005 table named 'EventTable' defined as such:
EventID, EventTypeCode, EventStatusCode, EventDate
Currently the table has a clustered index on the primary key 'EventID', there are no other indexes currently
EventTypeCode and EventStatusCode columns are CHAR(3) (examples are 'NEW', 'SEN', 'SAL') and are foreign key...
If I have a few UNION Statements as a contrived example:
SELECT * FROM xxx WHERE z = 1
UNION
SELECT * FROM xxx WHERE z = 2
UNION
SELECT * FROM xxx WHERE z = 3
What is the default order by behaviour. The test data I'm seeing essentially does not return the data in the order that is specified above. I.e. the data is ordered, but I wan...
Hi guys,
In the process of fixing a poorly imported database with issues caused by using the wrong database encoding, or something like that.
Anyways, coming back to my question, in order to fix this issues I'm using a query of this form:
UPDATE table_name SET field_name =
replace(field_name,’search_text’,'replace_text’);
And t...
While developing a new query at work I wrote it and profiled it in SQL Query Analyzer. The query was performing really good without any table scans but when I encapsulated it within a stored procedure the performance was horrible. When I looked at the execution plan I could see that SQL Server picked a different plan that used a table sc...
I have the following query which works fine with MySQL but refuses to work with SQL server:
SELECT table1.someField AS theField,
COUNT(table2.someField) / (SELECT COUNT(someField) FROM table1 WHERE someField = theField),
FROM table1 LEFT JOIN table2 ON table1.someField = table2.someField
SQL Server doesn't seem to like the ali...
Basically this code below returns the right information, but I need to add the quantities together to bring back one record. Is there any way of doing this?
select category.category_name, (equipment.total_stock-equipment.stock_out) AS Current_Stock, equipment.stock_out
from
EQUIPMENT,
CATEGORY
WHERE EQUIPMENT.CATEGORY_ID = CATEGORY.CAT...