Hi,
This is my first time using ms sql with cakephp. Usually I use mysql. I've edited my database.php file:
class DATABASE_CONFIG {
var $default = array(
'driver' => 'mssql',
'persistent' => false,
'host' => 'jura',
'login' => 'sa',
'password' => '********',
'database' => 'clientportal',
'prefix' => '',
);
...
I have a database (SQL server 2005 Express) table wth columns PatientID (more than 1 records can have same patient ID) and TestNo. I want to retrieve the maximum of testNo column among all the records with same PatientID.What should be the SQL statement to do so?I am using RecordSet pointer to access the records in a vc++ application.
...
This might be a stupid question. I need to have a Id field in a table. This Id is not a key (primary or whatever). The requirement says that user can input 10 digits in this field from the UI. This Id has no relation as of now with any otehr object in the system. Do you think If one can use nvarchar or bigint for this field. Does bigint ...
Hi All,
I need to take the backup of database in SQL server on network location through creating a job in SQL server 2005.
can anyone know how to do it?
...
How to prefix 'N' for the parameters in a store procedure for a unicode strings in c#, alternatively i am using the same procedure for the non unicode also. i need to append it only for the unicode ones kindly help.
...
Table has 2 cols: [nr] and [diff]
diff is empty (so far - need to fill)
nr has numbers:
1
2
45
677
43523452
on the diff column i need to add the differences between pairs
1 | 0
2 | 1
45 | 43
677 | 632
43523452 | 43522775
so basically something like :
update tbl set diff = @nr - @nrold where nr = @nr
but i don't want...
Hi all, it is possible to generate script from sql server using .net framework.
Example if I have database "Northwind". Then I wish to create/generate script insert" in form file extension .sql (ex: northwind_insert.sql).
Is something like when you using sql-server "right-click on table" > "script table as" > "Insert to" > "file".
I w...
hy there!
given:
| name
-+---------------------------
| Josef Knoller
| Josef Somos
| KFZ Wiesauer
wanted result:
JOSEFKNMLRZWIAU
(case in the result does not matter - it was just easier holding the UPPER key while writing)
is there any way to do this in mssql?
thanks in advance!
EDIT
sorry ... i've mixed column and row ......
Is is possible to get new values for Id (IDENTITY) before inserting data in a table ?
Is is possible to write something like that :
INSERT INTO Table1
SELECT *GET_NEW_IDENTITY*, Field1, Field2 FROM Table2
I need the values of Id because I want to insert data in Table1 and, just after, insert data in another table which has a foreign ...
I'm trying to add an SQL stored procedure to our PVCS directory, and I'm seeing a weird error pop up. First, I get a dialog box containing ÿþC. When I click OK on this dialog box, I'm told that -
An error has ocurred: The stored
procedure code does not use the CREATE
method. Please check your syntax.
Despite the fact that my...
Hallo All,
Please help in determining the best procedure for the following problem.
In a user interface, there is a provision to upload excel file. This is done by admin, once/twice in a day on a regular basis.
The code that i have used to upload excel file into sql server.
select *
into #temp FROM OPENROWSET('Microsoft.Jet.OLEDB.4....
Hi,
I need to drop and recreate a table, which exists to "cache" an expensive view. The view may change and I want to make maintenance as easy as possible, so I want the new table to reflect the latest version of the view.
I also want to be able to prevent read errors should a procedure try to access the table while it is in the middl...
I'm fairly sure this is an easy thing to do, but I'm a newbie at SQL so be gentle. If I want to write a query, that adds up the total occurences of each process number and stores those values to a new column, what do I do? I thought some mixture of count(distinct ...) could get it down but I'm not sure. See the result table for what I'm ...
Why does the comparison of value to null return false, except when using a NOT IN, where it returns true?
Given a query to find all stackoverflow users who have a post:
SELECT * FROM Users
WHERE UserID IN (SELECT UserID FROM Posts)
This works as expected; i get a list of all users who have a post.
Now query for the inverse; find a...
I've pasted a very simplified version of my SQL query below. The problem that I'm running into is that the ORDER BY statement is affecting the select results of my CTE. I haven't been able to understand why this is, my original thinking was that within the CTE, I execute some SELECT statement, then the ORDER BY should work on THOSE resul...
I have a SQL Server 2000 box that houses several databases, some of which are probably no longer in use. I'd like to clean things up by first taking them offline, and then later removing them all together. The problem is that I don't know how to tell which of these are still being actively used (outside sources may or may not be connec...
In my app the users gets to pick from a list of SQL Server in the network. The thing is I need to know if the chosen instance is a local or remote computer.
Is there a way I can ask that SQL instance what computer is she on? Is there a way a can figure that out?
Edit1: I want to know the host name where the SQL Server is hosted so I ca...
Given following table:
rowId AccountId Organization1 Organization2
-----------------------------------------------
1 1 20 10
2 1 10 20
3 1 40 30
4 2 15 10
5 2 20 15
6 2 10 20
Ho...
Dear All, I have another issue. I have in the SQL table Employees. This table has lot of details but I was missing images or photos.
So i managed to take all pictures for all employees but I have the pictures in the folder. Each picture is named like an Employee_id which matches the record in the table. How do I import images into SQL ...
Hi,
Is there a way in SQL SERVER or ORACLE that can use the case statment to convert the Unit of Measure below?
select UoM, sum(Quantity) as 'QTY'
from mytable
group by UoM
UoM QTY
LBS 2.4
LBS 2
LBS 0.233
LBS 0.97
OZS 1.8
GMS 1236
LBS 120.459
LBS 59.1
LBS 252.82
LBS 175.23
LBS 3.42
LBS 455.4
LBS 57.6
LBS 146.8
LBS 117.78
LBS 197.92
L...