To get digits after / in stored procedure
hi guys, I have a field in table.Suppose its value is 2009/1234.I want to get digits before'/'.I want to do this in stored procedure in sql.Can anybody help? ...
hi guys, I have a field in table.Suppose its value is 2009/1234.I want to get digits before'/'.I want to do this in stored procedure in sql.Can anybody help? ...
Hi all, I have there 2 codes on how to connect to SQL Server 2005 database. code 1 are using Dataset, and Dataadapter, code 2, didn't used neither. Can anyone please help me explain what is the differences and advatages/disadvantages on both programs..thankz code1 //create connection, dataset, dataadapter System.Data.SqlClient.SqlCon...
Hi all, I have records in table1, if the records exist, it must copy into table2. I want to delete those records in a table1 once all the records are copied into another table2. Im still a beginner in database and with some researches, i found some tutorials on d internet how to connect with database, and the codes easy to understand so...
Hi all. I have wrecked my brain on this problem for quite some time. I've also reviewed other questions but was unsuccessful. The problem I have is, I have a list of results/table that has multiple rows with columns | REGISTRATION | ID | DATE | UNITTYPE | 005DTHGP | 172 | 2007-09-11 | MBio | 005DTHGP |...
I currently have a SQL query that returns a number of fields. I need one f the fields to be effectively a sub query sub that. The Problem in detail: If I have a table X with two columns, ModuleID and say ModuleValue, how can I write a SQL query to take the results and Concatenate it into one field: EG Results returned from (SE...
On Oracle 10g we need to insert records from a view into a table to support a dumb client application that does not have sort or ORDER options itself. Is there any way to control the order in which our INSERT statement adds records to the destination table? ...
Hello everyone, I am using SQL Server 2008 and I need to select all data from one table of one DB into another table of another DB on the same SQL Server instance. Here is my script using. The server will run out of memory. The data is big -- table is about 50G size on disk. Any easy alternative solution or any solution to lower memory...
Hi, I am using SQL Query and below are the tables. Organization OrgID Name RAOGID RAOID SubGroupID StatusID 1 Org RAOG1 1 NULL NULL 2 2 Org RAO1 NULL 1 NULL 3 3 Org Sub Group1 NULL NULL 1 1 4 Org RAOG2 2 NULL NULL ...
I have problems because i don't really know how I can test my code and sql ( mysql ) to see how long SQL queries and PHP functions /code take to run. Does anyone here know where I can find these tools? ...
Hi I am having some problems turning the SQL below into a Zend Db query. $select = ' SELECT s.id, i.id as instance_id, i.reference, i.name, i.sic_code, i.start_date FROM sles s JOIN sle_instances i ON s.id = i.sle_id WHERE i.id = ( SELECT MAX(id) FROM sle_instances WHERE sle_id = s.id ) ORD...
I want to do something like this: SELECT locations.id, places.id, scannables.id, SUM(scannables.available) FROM `scannables` INNER JOIN places ON scannables.place_id = places.id INNER JOIN locations ON places.location_id = locations.id WHERE locations.id = 2474 AND scannables.bookdate BETWEEN '2009-08-27' and date_add('2009-08-27', IN...
I have 2 queries. First: SELECT * FROM `table` WHERE col='xyz' LIMIT 100 //Time Taken: 0.0047s Second: SELECT * FROM `table` WHERE col='xyz' ORDER BY Id DESC LIMIT 100 //Time Taken: 1.8208s The second takes a much longer time. I know why that is, it is because first I have to select the whole table, then do the ordering, whereas ...
Hi I have problem with SQL Server 2000 and queries that contain a large number of conditions. When these queries are sent to the SQL Server I get one of the following error messages depending on the query (error messages edited for readability): [Microsoft][ODBC SQL Server Driver][SQL Server] SqlDumpExceptionHandler: Process 61 genera...
I'm converting SQL from Teradata to SQL Server in Teradata, they have the format SELECT col1, col2 FROM table1 INTO @variable1, @variable2 In SQL Server, I found SET @variable1 = ( SELECT col1 FROM table1 ); That only allows a single column/variable per statement. How to assign 2 or more variables using a single SELECT statemen...
Good afternoon, I'm having a problem with a section of code I'm working on that checks to see if a dataitem of the same name already exists in a database. The following code throws up an IndexOutOfRangeException static int checkExists(String checkIf) { String connectionString = "provider=Microsoft.Jet.OLEDB.4.0;data source...
Hello everyone, I often see two styles, INSERT select and insert into select, what are the differences? Are they the same? I am using SQL Server 2008 Enterprise. Here are two samples. INSERT california_authors (au_id, au_lname, au_fname) SELECT au_id, au_lname, au_fname FROM authors WHERE State = 'CA' http://www.sqlteam.com/article...
Hi. I suddenly have begun to get the error message "Msg 2812, Leve 16, State 62, Line1, Could not find stored procedure 'sql'" when I run querie. The queries still execute correctly, but the output has the message at the top. No more than 10 minutes ago the queries worked fine (without the message), but now it gives this error. Is th...
I have problem in the following code : Set con = Application.CurrentProject.Connection Set rs = CreateObject("ADODB.Recordset") stSql = "SELECT * FROM [SB Items] " stSql = stSql & "WHERE [SBID]=" & Me![SBID] & " AND [ItemNumber]=" & intBtn rs.Open stSql, con, 1 ' 1 = adOpenKeyset ' If no item matches, report the ...
hi i am a beginner with sql server 2008, i was trying to add a file to a filegroup so that i an create a table which uses filestream, but i keep getting an errors. here is the code that i am trying: ALTER DATABASE dbtry1 ADD FILEGROUP dbtry1_fg_filestream CONTAINS FILESTREAM GO ALTER DATABASE dbtry1 ADD FILE ( NAME= 'dbtry1_files...
Helo, My question is I have one Stored Procedure in SQL Server that returns counts of a field. I want to store the results of this Stored Procedure in a variable (scalar?) of a different stored procedure. sp_My_Other_SP: CREATE PROCEDURE [dbo].sp_My_Other_SP @variable int OUTPUT -- The returned count AS BEGIN -- SP SET NOCOUNT ON; ...