Hi,
In my Sql database, I have tables
1 Account_Customer
-AccountID
-CustomerID
-Account_CustomerID
2 Accounts
-AccountID
-Balance
3 Customers
-CustomerID
-Name
-Sex
-Age
4 Loans
-LoanID
-Amount
-BranchName
5 Loan_Customer
-Loan_CustomerID
-LoanID
-CustomerID
and I want to write a stored procedure for
Listing customers togethe...
I have a table called trends_points, this table has the following columns:
id (the unique id of the row)
userId (the id of the user that has entered this in the table)
term (a word)
time (a unix timestamp)
Now, I'm trying to run a query on this table which will get the rows in a specific time frame ordered by how many times the colum...
SURVEYS table:
SurveyID
UserID
Question
Choice1
Choice2
Choice3
RESPONSES table:
UserID
SurveyID
Answer
The first desire (achieved): Show me all surveys that User 28 has initiated:
SELECT *
FROM Surveys
WHERE Surveys.UserID = 28
The second desire (achieved): Show me all surveys that User 28 has answered:
SELECT *
FROM...
Microsoft is pretty clear that .NET "identifiers" or "parameters" should not contain abbreviations. Straight from the horse's mouth:
To avoid confusion and guarantee cross-language interoperation, follow these rules regarding the use of abbreviations:
Do not use abbreviations or contractions as parts of identifier names. For ...
Which option is better and faster?
Insertion of data after creating index on empty table or creating unique index after inserting data. I have around 10M rows to insert. Which option would be better so that I could have least downtime.
...
I want to check if a variable is null. If it is null, then I want to set a value to that variable:
//data type of var is number
if Var = null then
var :=5;
endif
But I am geting error in it. How can I check if a variable is null?
I am using oracle data type
...
We have a Delphi 2006 application that drives a MS SQL Server database.
We have found a vulnerability where it is possible to load the executable into a hex editor and modify the SQL.
Our long term plan is to move this SQL to CLR stored procedures but this is some way off since many of our clients still use SQL 2000.
We've thought ab...
What are the downsides and limitations of using Linq to Sql verses writing a more traditional data layer calling stored procs/using dynamic sql through the .NET SQL Server data provider?
The advantages are well documented but I’ve found little discussion of the real world issues people have experienced.
Please note I’m not talking abou...
The code
ALTER PROCEDURE [dbo].[spSocial.QuestionsAddNew]
@IdUser int,
@IdQuestionCategory int,
@Title int,
@Body int,
@CreatedDate int,
@ActivityDate int,
@VotesCount int,
@AnswersCount int,
@ViewedCount ...
Hi there,
I build this little helper class to try class chaining in PHP to build SQL (atm very simple SELECTs) queries very easily.
Any ideas or complaints about it, or tips for the future?
class SQLQueryBuilder{
public $query;
public $parameters = array();
const SELECT = 'SELECT ';
const FROM = ' FROM ';
const WH...
I can see plenty of posts about where the field description extended property lives and how I can get it, but nothing about adding these at the CREATE TABLE stage.
I'm dynamically creating tables so dynamically adding field descriptions would be a tidy thing to do but I cannot see a way.
Has anyone managed to do this?
...
Let's say i have people who search for jobs, and i have a list of jobs.
So i have two tables:
people and jobs.
Now i have a list of skills of the person, and i have a list of skills for the job requirement.
What is better to have ONE skills table like this:
CREATE TABLE skills_reference
(
id INT,
reference_id INT, -- can reference peop...
Say I am not sure if table t in database d has a column x or not. Perhaps this is because some of the databases the application uses have been upgraded and some have not, so some have t.x and some don't.
Now say I just need a simple query to get a row from d.t and I want the value of d.t.x if the column exists and some default if not.
...
I need to generate unique and consecutive numbers (for use on an invoice), in a fast and reliable way. currently use a Oracle sequence, but in some cases generated numbers are not consecutive because of exceptions that may occur.
I thought a couple of solutions to manage this problem, but neither of they convincing me. What solution do ...
I looking for a function like regexp_split_to_table, but our db is version 8.2.9, so it doesn't have it. I'm really only splitting on a space, so a string like
how now brown cow
would return
+------+
|Column|
+------+
|how |
|now |
|brown |
|cow |
+------+
is there a simple function that can handle this, or something I ...
I have a table a with primary key id and a table b that represents a specialized version of a (it has all the same characteristics to track as a does, plus some specific to its b-ness--the latter are all that are stored in b). If I decide to represent this by having b's primary key be also a foreign key to a.id, what's the proper termin...
I have a requirement where i have two records with same value except the PK. how can i delete one of them.I have plenty of such duplicate records.
...
I have a situation where I need to group data by a portfolio name, then sort through the data and display check boxes. Here's the table structure.
Table A
--------
portfolio_id
portfolio_name
Table B
-------
file_id
portfolio_id (Foreign Key fk_port_id references portfolio_id in table A)
file_name
Basically Table A links to table B ...
Hello! I'm hitting the DB for a 100 records from a MySQL DB that have a DateAdded (timestamp) column.
I'd like to find a SMART way to display the records as follows in Coldfusion, w/o hitting the database multiple times.
Today:
- records.....
Yesterday:
- records.....
Earlier This Week:
- records.....
Earlier This Month:
- records.......
How do I execute a query like this using PHP:
SELECT [name] FROM [items] WHERE [ID]=1, [ID]=2, [ID]=3
and have MySQL return me all 3 rows?
ID name
-- ----
1 John
2 Jane
3 Jack
...