I am having issues with getting Guids to match in SQLite (0.4.8) when using parameters, when I use something like userGuid = 'guid here' it works, but userGuid = @GuidHere it does not. Anyone have any ideas?
Create:
CREATE TABLE Users
(
UserGuid TEXT PRIMARY KEY NOT NULL,
FirstName TEXT,
LastName TEXT
)
Sample Data:
INSE...
I need help with a join I think. Can't figure it out.
I have these tables:
Posts
`id` int(10) unsigned NOT NULL,
`title` varchar(140) DEFAULT NULL,
`text` text COLLATE utf8_unicode_ci
Posts tags
`post_id` int(10) unsigned NOT NULL,
`tag_id` int(10) unsigned NOT NULL
Tags
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varc...
Hi,
I have a table "users" with a column "date_of_birth" (DATE format with day, month, year).
In frontend I need to list 5 upcoming birthdays.
Spent ages trying to work out the logic.. also browsed every possible article in Google with no luck..
Any suggestions how to do this in RoR?
Thanks!
...
After creating a new user john with: CREATE USER john PASSWORD 'test';
CREATE DATABASE johndb OWNER john; I can connect to the PostgreSQL server with: psql -U john johndb The problem is that psql never asks me for the password. I realy need to know what's wrong, because of obvious reasons.
...
I'm trying to create a website for my friends and I to keep track of fantasy sports scoring. So far, I've been doing the calculations and storage in Excel, which is very tedious. I'm trying to make it more simplified and automated through a SQL database that I can then wrap a web app around to enter daily stat updates.
It's premised...
Hi, I searched in google and also visited the
decimal and numeric and
SQL Server Helper
to glean the difference between numeric , float and decimal datatypes and also to find out which one should be used in which situation.
For any kind of financial transaction, which one is prefered and why? e.g. for salary field
...
Hi all,
I have a table called Basic , start_time is one field with type :VARCHAR(5), which actually stores a 5 bytes time data: byte 0 and 1 map to the year , month and day, and byte 2 to 4 map to the hour, min and second. So, it could possible bytes 2 ,3 ,4 are all 0. And I want to do following query :
Basic.find (:all , :conditions =...
Hello
I created a scalar function in the DB
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER FUNCTION [dbo].[fn_GetUserId_Username]
(
@Username varchar(32)
)
RETURNS int
AS
BEGIN
DECLARE @UserId int
SELECT @UserId = UserId FROM [User] WHERE Username = @Username
RETURN @UserId
END
Now I want to ru...
I have this table called Online_Transaction and i want to show all the types of transactions and how many where made of each type (completed,rejected,pending for authorization) in a specific month. I have this query until now but I get repeated results any ideas?
SELECT DISTINCT
TRANSACTION_TYPE_ID ,
YEAR(CREATED_ON) AS YEAR ,
...
Hi,
Can any one out there suggest a microsoft tool similar to Red Gate's sql promt,sql compare,sql data compare etc.Any help is appreciated.Thanks
...
First note that I have seen this question:TSQL delete with an inner join
I have a large table and several foreign key relations, each of which have data of a given age. We need to remove data older than a given data on a regular basis to stop the DB from growing without bound.
I'm writing a query that will delete from each point on th...
So i learned how to do a bulk insert using data from one table as the userId from another table. Now i tried to do the same thing but i have a SQL(ite) error. I took a guess at the syntax and i got it wrong. After i bulk insert into the subscription i want to add 1 to each of the users media count. I have a left join error. How do i corr...
I've got this table with an int(11) column and hundreds of millions of rows. When I run a query like
SELECT SUM(myIntColumn) as foo FROM myTable;
the return value does not make sense--it is smaller than the the single largest max value. My values for this column max out somewhere around 500m, and the signed int should be able to ha...
In SQL Server 2005 while doing Replication (Snap Shot/ Transactional/ Marge Replication), what are the master tables are used ?
...
This is related to my previous question More than 1 Left joins in MSAccess
The problem is that I have 3 left joins followed by an AND operator to check 1 condition.
If I run, then I am getting an error "Join Expression not supported".
The query goes like this:
SELECT * FROM(( EMPLOYEE AS E LEFT JOIN DEPARTMENT AS D ON E.EID=D.EID)
...
I have a set of data in a table named BWHourlyReadings, for example:
ServiceID Hour InputOctets OutputOctets
========= ==== =========== =================
27222 1 383088 804249
27222 2 270529 688683
27222 3 247251 290124
... up to 24 hours of data
27222...
What is the limit of rows in a table for SQL Server 2005, when SQL query starts getting slower? Is there any way to find out the limit?
I understand it will depend upon the data length of a row. This will also depend on how many more data in other tables and the hardware available.
...
Hi,
I'm looking for some help on constructing a query. I have three tables like this:
Products
id | (20 other columns I don't need)
1
product_names
product_id | product_name
1 my product
2 my second product
3 my third product
cross_sell_products (where each product may h...
I'm trying to convert some SQL queries into Linq to avoid multiple trips to the database.
The old SQL I'm trying to convert does:
SELECT
AVG(CAST(DATEDIFF(ms, A.CreatedDate, B.CompletedDate) AS decimal(15,4))),
AVG(CAST(DATEDIFF(ms, B.CreatedDate, B.CompletedDate) AS decimal(15,4)))
FROM
dbo.A
INNER JOIN
dbo.B ON B.Par...
i have taken the default asp.net mvc template and customized to work for me. I want to now upload this to my hosting provider.
how do i get the sql server database into my server. Do i just upload the ASPNETDB.mdf file. What is this file actually? Does it represent the whole database.
Can i simply copy that file around to migrate m...