My DBA told me to use a user-defined SQL datatype to represent addresses, and then use a single column of that new type in our users table instead of multiple address columns. I've never done this before and am wondering if this is a common approach.
Also, what's the best place to get information about this - is it product-specific?
...
I've been asked to try to roll back some database changes if there was an error.
Before I even start trying to use a TRANSACTION with either COMMIT or ROLLBACK, could someone tell me if I can do the following in MS Access?
void Start() {
try {
AccessDatabaseOpen(); // Opens the access database
foreach (File in FileList) {
...
This is with Microsoft SQL Server 2008.
I've got 2 tables, Employee and EmployeeResult and I'm trying to write a simple INSERT trigger on EmployeeResult that does this - each time an INSERT is done into EmployeeResult such as:
(Jack, 200, Sales)
(Jane, 300, Marketing)
(John, 400, Engineering)
It should look up for the Name, Department...
we have created following anonymous block...........
DECLARE
sql_str long(32000);
where_str long(32000);
counter NUMBER(3):=0;
BEGIN
sql_str:='SELECT '||' A.bio_id ,';
where_str:=' where '||'A.bio_id=B.bio_id AND'||' A.bio_id<>0 and rownum<25 AND (' ;
LOOP
counter:=counter+1;
sql_str:=sql_str||'decode(A.wk_unit...
hi there,
I have a stored procedure and trying to run "sp_OACreate" but fall over with the following message:
Msg 50000, Level 16, State 1, Procedure HTTP_REQUEST, Line 26
sp_OACreate on MSXML2.XMLHttp.4.0 failed
That occurs because I am setting a variable to get the return value of sp_OACreate and raise the above error if the retur...
I am looking for an efficient sql backed collections library, for the Java programming language.
I need to do database manipulations that fit very well the Collections API, is there something that can be a good bridge for that, or must I roll my own thing.
...
I have a SqlCommand which inserts a datetime into column using a SqlParameter. At present I use DateTime.Now as the value of this parameter.
I believe this will add the datetime on the user's PC which is not consistent.
How do I change this so the datetime of the database server is inserted?
EDIT:
I should have made it clear this wa...
Can anybody let us know an easier way to get the result as shown by following query? We need to find a way that can show us the same result as the following query:
SELECT DISTINCT A.bio_id ,
DECODE(A.wk_units2 - B.wk_units1,0,NULL,A.wk_units2) prev,
DECODE(A.wk_units2 - B.wk_units1,0,NULL,B.wk_units1) curr,
DECODE(A.wk_uni...
I have a sql table called UsersInAuthentication like
-----------------------
| AuthUserId | UserId |
| 1 | 4 |
| 1 | 5 |
| 1 | 8 |
-----------------------
I wish to get all users in format "(4,5,8)" as string with a single stored proc and
If possible I also wish to insert,update,delete operat...
I have query that work for me only when values in the StakeValue don't repeat.
Basically, I need to select maximum values from SI_STAKES table with their relations from two other tables grouped by internal type.
SELECT a.StakeValue, b.[StakeName], c.[ProviderName]
FROM SI_STAKES AS a
INNER JOIN SI_STAKESTYPES AS b ON a.[StakeTypeID] ...
For the database in my project I have a drop/create script for the database, a script for creating tables and SPs and an Access 2003 .mdb file with some exported values.
To set up the database from scratch I can use my SQL management studio to first run one script, then the other and lastly manually run the sort of tedious import task.
...
Right now, to see the code of an existent stored procedure I have to RightClick -> Modify it, is there a way for me to just see the code?
...
Hi,
I have uploaded a text file to my database into a Image field. The problem is when I try to retrieve the file (make the user able to download it on a click on a link). When I try to download it, it is simply filled with the content of the webpage (all the html is filled into the text file). I am considering it to be an error with the...
This is a very very important sql query after which my whole website is based..
and its not working..
Its difficult to explain without an example..
There are 2 tables, One is IngredientsTable and other one is ProductsTable.
In IngredentsTable i have the following
Bread
ChickenBreast
Noodles
Mayonaise
Cheese
Ketchup
Butter
And the...
Hi,
I am trying to download a file I have uploaded to an image field in my MS-SQL database. The problem is that when I try to open the file it just says System.Byte[] instead of containing the actual content.
UploadFiles is my class which contains the filename, id, filedata etc.
public void DownloadUploadedFile(Page sender, UploadFiles...
I would like to update the top 400 rows in a database table. The pseudo SQL is below, how can I do this?
UPDATE top (400) db.dbo.tbl
SET column1 = 2
WHERE column2 = 1
AND column1 is null
...
What is the most efficient way to write a select statement similar to the below.
SELECT *
FROM Orders
WHERE Orders.Order_ID not in (Select Order_ID FROM HeldOrders)
The gist is you want the records from one table when the item is not in another table.
...
How to write (simple) LINQ to Entities query that groups elements by some attribut and count them?
SELECT answernumber, count(answerID) FROM answers
WHERE questionID = id
GROUB BY answernumber
ORDERBY answernumber;
That should be simple but i don't know how to write it.
...
I have a web application running with a SQL server 2005 DB as back end.I took the db back of the production site and restored in my development machine.Then i tried to query this database using the login "sa".When trying to execute the "select * from Customers" query, i am getting a message like "Invalid object name 'Customers"
But when ...
Hi,
I have a query that gets a result, limits it and then does a sort around the limited results. Something like:
(SELECT SQL_CALC_FOUND_ROWS * FROM table ... ORDER BY score DESC LIMIT 0,15) ORDER BY name ASC;
Using
SELECT FOUND_ROWS() AS total
after will always return 15 due to the sub sort. Is there a way around this?
Thanks!...