sql

SQL 2000 - Enterprise Manager & Triggers

We use SQL 2000 Enterprise Edition. We have noticed that the triggers are not executed when we make data changes using the Enterprise Manager. That is, we execute a "Select" query, and we edit the results directly in the grid results table. The trigger is valid since it is executed as expected if we run an update query. I am just wonde...

how to replace an element in every column of database table?

Hello, I am not a guru of databases, do most of the things through PHP, like data manipulation as well, even if it is an internal task. However, PHP is not being very useful in this case. I have a table with about 0.4 million records in it and it has like 16 columns, everything else works fine but I populated this table from a text file ...

How to do Encryption and Decryption in Sql Server 2005

I want to encrypt and decrypt data with sql server using RSA or SHA algorithm rahter than doing it at UI. Is it possible to do this. Some Code Snippet will be a great help ...

SQL: How to select 1st, 3rd, 11th and nth row from a table?

How to select 1st, 3rd, 11th and nth row from a table? ...

Passing value through parametised query

Hi there, I've created a parametised query to get article/page content as follows; <% article = cint(request("article")) Set conn = Server.CreateObject("ADODB.connection") conn.Open Application("database") Set cmd = Server.CreateObject("ADODB.command") With cmd .ActiveConnection ...

Order results by column dynamically depending on where a match was found

Hi, I'm selecting data from a table where one of 3 columns matches a given search string: SELECT * FROM CARS WHERE MODEL LIKE searchString OR MANUFACTURER LIKE searchString OR DESCRIPTION LIKE searchString But I need to order the results depending on where the match was found, based on a column weighting. I.e. if the match was found...

Entity Framework - writing query using lambda expression

Hi, I have just started Entity Framework & linq and write this query var query = from rp in db.UM_RolePermission where (from ru in db.UM_RoleUser where ru.UM_User.UserID == userId select ru.RoleID).Contains(rp.RoleId) select rp; above is working fine and fullfill my need, however I am trying to write t...

Java Resultset.get***(...) quicker by string or int?

When iterating through a Resultset in the standard way while (rs.next()){ ... } To retrieve column data (e.g long) is it quicker to use rs.getLong(String columnLabel) or rs.getLong(int columnIndex) Presumably columnLabel is better to use in many ways for stronger code, but is there a significant operational loss by matching a co...

How do I query for data that falls between two dates?

I have an html form to select two dates from dropdown. Now I need to retrieve all records from a MySQL database which lie between those dates. Can anyone help me? ...

Updating every row in a table with IF Statement conditions

Hi everyone, this one has me stuck fast. Data: Month Total Impact Forecast ------------------------------------------------ 2010-04-01 45792.0000 1.0000 NULL 2010-05-01 51789.0000 1.0000 NULL 2010-06-01 58228.0000 1.0000 NULL 2010-07-01 52956.5217 1.0000 NULL 2010-08-01 53600....

What is the best way to search an Oracle CLOB column?

I need to search a CLOB column and am looking for the best way to do this, I've seen variants online of using the DBMS_LOB package as well as using something called Oracle Text. Can someone provide a quick example of how to do this? ...

How to drop all tables in database without dropping the database itself ?

I would like to delete all the tables from database, but not deleting the database itself. Is it possible ? I'm just looking for shorter way than removing the database and create it again. Thanks ! ...

PHP unwanted error

There isnt an actual error, but it's still displaying an error message when a user who is not the buyer or seller goes to the page. Is it possible to suppress the error message? Direct link to images http://i37.tinypic.com/2m5ijvq.jpg http://i36.tinypic.com/148kads.jpg //transaction id $transactionid = $_GET['id']; //Retriev...

Converting a stored procedure into user defined function

Hi, i need help in converting a stored procedure to a function, CREATE PROCEDURE [dbo].[FunGetEmpExp] ( @fromdate DATETIME,@todate DATETIME) AS BEGIN DECLARE @TotalYears VARCHAR(2) DECLARE @TotalMonths VARCHAR(2) DECLARE @TotalDays VARCHAR(2), @Duration varchar(10) SET @TotalYears = null SET @TotalMonths = NUL...

sql query is returning the same values twice

Hi There, I have this sql query, and it should be returning two values, which is does but it returns each returned row twice, the sql looks like this, SELECT * FROM `mailers` LEFT JOIN `mailer_content` ON `mailers`.`id` = `mailer_content`.`mailer_id` LEFT JOIN `mailer_images` ON `mailer_content`.`id` = `mailer_images`.`content_i...

sql query to avoid null value parameter

these are the variables i am passing to some method where i need to write some sql query like string cmd = @"select * from students_tbl where course_id=@courseId and branch_id=in(+" branchId "+) and passout_year>=@passoutYear and current_backlog>=@currentBacklog and gender=@gender and eGap<=@eGap and first_year_percent>=@firstyearP...

Queries to get all ancestors/descendents of a tree in a db?

I have a table (id, parent_id, data) where parent_id points to another row in same table (or is null). Is there a standard way to query (1) all the ancestors of a certain id and (2) all the descendants of a certain id? I'm also doing this in DBIx::Class, so if there's a most convenient way to do it with that module (or some other), I'd...

How to insert new row to database with AUTO_INCREMENT column without specifying column names ?

I have a table with the following columns: id - INT UNSIGNED AUTO_INCREMENT name - VARCHAR(20) group - VARCHAR(20) I know that I can add a row like this: INSERT INTO table_name (name, group) VALUES ('my name', 'my group') I wonder if there is a way to add a row without specifying the column names, like when there is no AUTO_INCREM...

How do I run SQL queries on MDB files?

I need to run an UPDATE query on a large MDB file (~30mb), is it possible? how? ...

How do you add a relationship in a dataset that contains three tables : e.g. users, roles and user_roles

My problem is like this : i got 3 tables : - users (user_id, name) - roles (role_id, role_name) - user_roles(user_id, role_id); I load them all in a dataset The challenge is to build a relation (or more?) in this dataset, that when given to a ultragrid (infragistics) they would display right - for each user his roles (name, descripti...