sql

Outer Join with Where returning Nulls

Hi I have 2 tables. I want to list all records in table1 which are present in table2 all records in table2 which are not present in table1 with a where condition Null rows will be returned by table1 in second condition but I am unable to get the query working correctly. It is only returning null rows SELECT A.CLMSRNO,A.CLMPLAN...

What is a good wrapper/framework/libraries for dealing with interface PHP applications to an SQL database?

I have a table $query= "CREATE TABLE screenshot ". "(screenshot_id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, ". "source_video_id INT UNSIGNED NOT NULL, ". "screenshot_file_name VARCHAR(128), ". "x_res INT, ". "y_res INT, ". "time INT UNSIGNED);"; mysql_query($query); Then I insert things into that table. I often want to do an SQL quer...

Cast string data type to Int in SQL QUery for MS Access

I am trying to write a query in access that will pull results that are in the database in a text Acually,I have RECEIPTNO Column whose datatype is TEXT in Table Membership, & I want to pull all the results from RECEIPTNO column where RECEIPTNO is BETWEEN 1 AND 10 And I tried Below Code. SELECT Cint(RECEIPTNO) FROM MEMBERSHIP where Cint...

How to find first and last date of week specific to month?

Dear Team, How to find first and last date of week specific to a month on passing of getdate()? For Example: Case 1 Today is '16 July 2010' I want Week_Start_Date as '11 July 2010' and Week_End_Date as '17 July 2010' Case 2 Today is '2 July 2010' I want Week_Start_Date as '1 July 2010' and Week_End_Date as '3 July 2010' Any help ...

how to write following query?

SELECT column1 FROM table1 WHERE EXISTS ( SELECT column1 FROM table2 WHERE table1.column1 = table2.column1 ); ...

SQL ENCODING IN SQL Management studio

Hi all We have tri-lingual system at work, english,greek and russian. I have an issue with russian when i update some of the fields in my database. If i use an update query to update a field form the default english to russian i get '?????????' instead of the russian characters.if i update directly by hand it shown correctly. Help! ...

Hardcore SQL(ite) : fetch segment intersection.

Hi folks ! So this one is a very difficult one I think, so I'll try to make it as clear as possible. So basically, I have geographic datas : Nodes (#ID,lat,lng) WayNodes (#ID,#node_id,#way_id, sequence) Ways(#id,name) And what I want is to get the intersection of two GROUPS of ways. For example I need to find intersection(s) between...

Hibernate HQL NULL comparison pattern

Imagine a simple web page allowing you to search Bookings like this: If the Booking Number field is not populated I want to return all rows. If the Booking Number field is populated I only want to return that row. I have been using a pattern in Hibernate (with an underlying MySQL database) to accomplish this that goes something lik...

how to pass the result of SELECT statement to Stored Proc

what's the proper way to write it? Thx SELECT [JobId] as jobid FROM [v_Jobs] WHERE jobreference =177127 EXEC [dbo].[s_someStoredProc] @JobID = jobid ...

SQL 2005 Update - number of counts issue

I am using SQL 2005. When i am selecting a set rows from the table with the appropriate where condition, it return value as 31. The same select value if i update to another table it is updating as 30. i used the SQL update as follows update tablename set column1 = (Select column2 from tablename where month(field1) = 05 and year(field1) ...

Elmah Timeout error on logging /insert all of a sudden

Alright we are quite sure the Elmah has become too big. Apparently the database is sitting at 17GB because of this. Were were getting timeout errors accessing /elmah first and now there are errors inserting data into it - hence exceptions are being thrown by the application. I just wanted to confirm can INSERT timeouts happen - or does ...

SQL Server Profiler Issue

I am using SQL Server Profiler to monitor the queries executed at my database. Is it possible for an update query executed twice with the same scenario and same state to have two different number of writes and reads on SQL Profiler ? ...

sql server management studio problem.

hello friend on w7 i configured my sql sever and ssms but while going through ssms it's producing following error...please resolve my problem. TITLE: Microsoft SQL Server Management Studio Express The database model is not accessible. (Microsoft.SqlServer.Express.ObjectExplorer) ...

how to start SQL Server 2008 service from command prompt?

i want to start the Microsoft SQL Server 2008 services from command prompt. how can i achieve through command prompt? ...

Fluent NHiberante - Many To Many Relation

I have Product and Category tables in database. One product can have many categories. One category can have many products. So, I have a third table as ProductCategory, which has ProductID and CategoryID. In Fluent NHibernate, what does the mapping class should look like? For example, For ProductMap class is it correct: HasMany(x =>...

SQL Server 2008 SP1 takes a long time to restore database

Hi all, I'm using SQL Server 2008 SP1. It takes a long time when restoring the database from backup file. Following the Microsoft support website (http://support.microsoft.com/kb/975089) that was a bug of SQL Server 2005 & 2008 and they released a update package which named "Cumulative update package 5 for SQL Server 2008 Service Pack 1...

Merging two rows to one while replacing null values

Hi. Let's say I've got the following database table Name | Nickname | ID ---------------------- Joe Joey 14 Joe null 14 Now I want to do a select statement that merges these two columns to one while replacing the null values. The result should look like this: Joe, Joey, 14 Which sql statement manages this (if it'...

T-SQL Emitted by the aspnet_regsql.exe when working wih Sql Cache Dependency

Hi All, Recently our application went for Load Testing and in the profiler trace of out DB we found out that the T-SQL emitted by the aspnet_regsql command ran for more than 341 times, whereas it must only for the creation of the Notification table and the SPs it uses for reading and writing values into this table. Does anyone have any ...

SQL Server, Unused tables for a long time (How to get rid of unnecesarry tables)?

Is there a way to find the unused tables which are nothing else but rubbish in database ? ...

SQL Server - Select integer that falls between brackets ( )

HI, how can i select the Integer that falls between a pair of ( ) begining from the right of a cell? Reason being, there might be another pair of brackets containing characters and what if some records are w/o close brackets for some reason.. e.g. Period | ProgrammeName | Jan | ABC (Children) (30) | Feb | H...