sql

Why Did Microsoft Create its Own SQL Extension (T-SQL)?

What are the reasons behind Microsoft implementing its own SQL extension as Transact SQL (T-SQL)? What are its advantages over the normal SQL? ...

VBA sql query problem

Below query is resulting NO rows lstResults.RowSource = "select EmpId from tblTesting where Empid ='" & Me.txtSearchEmpId.Value & "'" Where below working fine : lstResults.RowSource = "select * from tblTesting" WHere is the fault here? I check the value of '" & Me.txtSearchEmpId.Value & "'" using break point its having the value o...

redirection of pages

how i can redirect from my login page to home page after the login is success? I have one database in this it stores the username and password. at the time of login it wil check the user name and password by sql query. my code is shown below. protected void Button1_Click(object sender, EventArgs e) { if (TextBox1.Text == ""...

Oracle with join , need uniques

Hi i have a "small" problem , iam using join to get some names for OS Architectures. SELECT "OSARCH".*, "OS".* FROM "OSARCH" INNER JOIN "OS" ON OSARCH.OSARCH_ID = OS.OSARCH_ID The result is something like this : OSARCH_ID OSARCH -- ------- 22 Powerpc 22 Powerpc 22 Powerpc 28 x86 28 x86...

SQL Return values in Delphi via ADO

Hi. Im having this function to determine weather a user exists in a database or not DM is my DataModule AQ_LOGIN an ADOQuery BENU is my Table filled with Users and their Password Here comes the code: function UserCheckExist(Login, pw: string): boolean; begin with DM do begin AQ_LOGIN.Close; AQ_LOGIN.SQL.Clear...

Query for total should keep on adding with each row of cost Column

Hi I have table with columns as Operation Cost Material Issue 10 Material Return 20 X 30 Y 40 Z 50 I want want a query where columns are Operation Cost Total Material Issue 10 ...

Profiling Linked Server

I'm trying to optimize a set of stored procedures. These stored procedures are on Server A and do the following actions: Delete data on Server B based on a parameterized query on Server A DELETE FROM B (via linked server) DO SOME JOIN ON A WHERE A.x IN (@ID1, @ID2, @ID3, @ID4) Insert data on Server B based on a parameterized query on ...

SQL - Concatanation of all values in a foreign table to use in the primary table

I have one table that has sales records and another table that has additional details on each record. What I need to do is build a query that will query the first table and, for each record, list additional details in a virtual column, like this: "Additional detail #1 for record 1: some additional detail; Additional detail #2 for record ...

Who is right? - SQL Rollback Question

Hi together, a few minutes ago I had a discussion with my boss and want now more meanings, if I am wrong or he is. Following problem is given: After a fast change from a colleague a stored procedure went wrong. (I think for the theory here is no more information requiered) We decide to provide the correct version in an Update Script: ...

searching for a word in database

I am storing questions and answers in a database like FAQs and i want to allow the user to search. so for example the user will enter "how to bla bla bla" and i will search for every word and neglect the common words like "the", "to", "is" .... so this was my idea, do you think its a good one or you suggest something better? and how to ...

Grouped LIMIT in PostgreSQL: show the first N rows for each group?

I need to take the first N rows for each group, ordered by custom column. Given the following table: db=# SELECT * FROM xxx; id | section_id | name ----+------------+------ 1 | 1 | A 2 | 1 | B 3 | 1 | C 4 | 1 | D 5 | 2 | E 6 | 2 | F 7 | 3 | G 8 | 2...

Manipulate DATA FILE (text) stored as varbinary(max) in sql table

Hi, looking for help and need pointing in the right direction, can anyone assist? Have a data file (txt) that contains 10000 numbers/data points. Storing the data file as varbinary(MAX) in an SQL table. My goal is to retrieve the file on user request and plot/chart the numbers as a line chart. No problem in getting DataReader to displ...

SQL Server Tree Hierarchy and Nested Sets with Duplicate Record ids

Given that I have this resultset structure (superfluous fields have been stripped) Id | ParentId | Name | Depth ---------------------------- is it possible to have the records returned in tree order i.e. Parent then Children, if a Child is a Parent, then their Children, if not then Sibling, etc? For example, Id | ParentId | Name | De...

How to Add Quotes to a Dynamic SQL Command?

I am storing and editing some field in a database that involves a long string of one or more sentences. whenever i enter a single quote in the textbox and want to save it it throws an exception like "Incorrect syntax near 'l'. Unclosed quotation mark after the character string ''." is there any idea to avoid that? EDIT: The query is: ...

Multiple Search Option in SQL SERVER 2005

I have a requirement. Given say Test1,Test2, I have to perform a like operation. Something like select * from tblname where column_name like('Test1%','Test2%'); i.e. these strings are comma separated How do I solve this? This is in SQL SERVER 2005. Thanks in Advance ...

simple sql query

which one is faster select * from parents p inner join children c on p.id = c.pid where p.x = 2 OR select * from (select * from parents where p.x = 2) p inner join children c on p.id = c.pid where p.x = 2 ...

Fetching data

I have one database table which contains 8 columns. One of the columns is called IsAdmin (its data type is Bit). I have to show the user list in a grid view if and only if the signed-in user is an admin. How can I do this? Which clause is used for this? ...

Sql optimization Techniques

I want to know optimization techniques for databases that has nearly 80,000 records, list of possibilities for optimizing i am using for my mobile project in android platform i use sqlite,i takes lot of time to retreive the data Thanks ...

VBa insert shortcut

I am planning to insert value in a vba access form text box values to the table in same access file Here i will write a insert query on the submit button click event Is there any shortcut methods to add the value into the table? Like seting the datasource for the textbox and inserting values of all textbox in the form using a click o...

Programatically check if a date-period has expired and possibly add new row to a table, daily.

I have a table, named ReportingPeriods, that I want to be populated entirely automatically. In another table, there are attributes CreationDate and ReportingPeriodLength which together will determine the the results of this row. Upon adding a row for this table, we will add a row in ReportingPeriods with the first StartDate as the crea...