Hi All,
I have the following table.
CREATE TABLE TEST(ID TINYINT NULL, COL1 CHAR(1))
INSERT INTO TEST(ID,COL1) VALUES (1,'A')
INSERT INTO TEST(ID,COL1) VALUES (2,'B')
INSERT INTO TEST(ID,COL1) VALUES (1,'A')
INSERT INTO TEST(ID,COL1) VALUES (1,'B')
INSERT INTO TEST(ID,COL1) VALUES (1,'B')
INSERT INTO TEST(ID,COL1) VALUES (2,'B')
I ...
I have table :
number city1 city2 mentions
1 a b 5
1 b a 5
1 c d 2
1 d c 2
what I need is to remove duplicate records, such as a, b equal to b,a became :
number city1 city2 mentions
1 a b 5
1 c d 2
any clue for me ?
thanks before :)
...
How can I write single UPDATE query to change value of COL1 to ‘X’ if COL2 < 10 otherwise change it to ‘Y’, where the following two tables are linked by ID
CREATE TABLE TEMP(ID TINYINT, COL1 CHAR(1))
INSERT INTO TEMP(ID,COL1) VALUES (1,'A')
INSERT INTO TEMP(ID,COL1) VALUES (2,'B')
INSERT INTO TEMP(ID,COL1) VALUES (11,'A')
INSERT INTO TE...
Hi,
I am using SQL Server 2008 and the WebSharingAppDemo-SqlProviderEndToEnd sample and this is almost perfect for my needs however I am unable to detect conflicts.
By default ConflictResolutionPolicy is set to ApplicationDefined. I have tried setting the ResolutionPolicy to SourceWins, DestinationWins or ApplicationDefined and I alwa...
I have the following table:
CREATE TABLE TEMP (ID INT, SEGMENT CHAR(1), SEGOFF INT, CHECKED SMALLDATETIME)
INSERT INTO TEMP VALUES (1,'A',0,'2009-05-01')
INSERT INTO TEMP VALUES (2,'B',1,'2009-05-01')
INSERT INTO TEMP VALUES (3,'C',0,'2009-05-01')
INSERT INTO TEMP VALUES (4,'A',0,'2009-05-02')
INSERT INTO TEMP VALUES (5,'B',2,'2009-05-...
We have a database in which all the PKs are GUIDs, and most of the PKs are also the clustered index for the table. We know that this is bad (due to the random nature of GUIDs). So, it seems there are basically two options here (short of throwing out GUIDs as PKs altogether, which we cannot do (at least not at this time)).
We could chan...
Hi Folks,
I have a serious performance problem.
I have a database with (related to this problem), 2 tables.
1 Table contains strings with some global information. The second table contains the string stripped down to each individual word. So the string is like indexed in the second table, word by word.
The validity of the data in the...
I have a pattern that I almost always follow, where if I need to wrap up an operation in a transaction, I do this:
BEGIN TRANSACTION
SAVE TRANSACTION TX
-- Stuff
IF @error <> 0
ROLLBACK TRANSACTION TX
COMMIT TRANSACTION
That's served me well enough in the past, but after years of using this pattern (and copy-pasting the above c...
I need a confirmation.
Client 1 insert rows in a table inside a transaction.
Client 2 request this table with a SELECT. If on this client isolation level is set to READ COMMITTED, can you confirm that the SELECT won't returns the rows that aren't yet committed by Client 1.
Thanks
...
I need to implement nested transactions in .NET using ADO.NET.
The situation is as follows:
--> Start Process (Begin Transaction)
--> Do DB things
--> Begin Transaction for step 1
--> Step 1
--> Commit transaction for step 1
--> Begin transaction for step 2
--> Step 2
--> Rollback transaction for s...
I want to unlock one account in SQL Server. Before unlocking I have to check whether that account is locked or not.
I want to unlock only if the account is locked.
Is there any SQL query or stored procedure to get the "Locked" status of SQL user?
...
I'm having a coloumn name with varchar field that holds some folder path like "C:\Program Files\Internet Explorer\en-US" .I need to update the root folder name(Program files to profilesNew).Can anyone please help.
I tried with a query
declare @val as varchar(100)
set @val='C:\Program Files\Internet Explorer\en-US'
select substring(@va...
I see that with SQL Server 2005 you can pass a parameter as numeric e.g.
create procedure dbo.TestSP
@Param1 numeric
as
But what does this equate to? E.g. Numeric(10,0), Numeric(9,2), etc? We have some Developers here who are using this instead of the correct definition for the field that this parameter is going to be used agains...
I have virtual hosting with SQL Server. I don't have physical access to SQL Server. I want to make backup and download it. How can I do it from asp.net page?
...
I have the following transaction:
SQL inserts a 1 new record into a table called tbl_document
SQL deletes all records matching a criteria in another table called tbl_attachment
SQL inserts multiple records into the tbl_attachment
Until this transaction finishes, I don't want others users to be aware of the (1) new records in tbl_docu...
I am trying to write a database script (SQL Server 2008) which will copy information from database tables on one server to corresponding tables in another database on a different server.
I have read that the correct way to do this is to use a sql statement in a format similar to the following:
INSERT INTO <linked_server>.<database>.<ow...
I am used to developing in PHP/MySQL and have no experience developing with SQL Server. I've skimmed over the PHP MSSQL documentation and it looks similar to MySQLi in some of the methods I read about.
For example, with MySQL I utilize the function mysql_real_excape_string(). Is there a similar function with PHP/SQL Server?
What step...
My code does not update the thread field. It is null. Anyone have any ideas?
INSERT INTO [Messages]([Sender], [Receiver], [Job_Number], [Subject], [MessageText], [DateSent])
VALUES(@Sender, @Receiver, @Job_Number, @Subject, @MessageText, @DateSent)
SET @ThreadID = SCOPE_IDENTITY()
UPDATE [Messages]
SET Thread = @ThreadID
WHERE Messag...
Hi,
I have recently taken on a project in which I need to integrate with PHP/SQL Server. I am looking for the quickest and easiest function to prevent SQL injection on SQL Server as I prefer MySQL and do not anticipate many more SQL Server related projects.
Is this function sufficient?
$someVal = mssql_escape($_POST['someVal']);
$que...
Hi, Folks. I have this problem using JBOSS, EJB3 and MSSQL Express . i'm trying to persist an entity with an Blob attribute which was converted into a byte[], apparently it create the entity perfectly, no error was logged at jboss's console. but when i check into database the column is null. i already checked the Object to byte[] method ...