Is there a way to find out when a stored procedure or table was last modified? I tried checking the properties via SQL Management Studio, but only found the creation date.
Thanks!
Hello everyone,
I am looking for some reference/samples about how to define good KPI for education industry. I want to define KPI from school/department management perspective to measure various school performance, students/faculty/others.
Any advice, referneces or documents are appreciated -- more appreciated if with the context of SQL Server 2005/2008.
thanks in advance,
George
I have a table named scores with the columns id and score. I want to access a specific record by its id as well as the 5 records before and after it. Is there a way in SQL to say "grab the score with the id of n and x items before and after it?"
I'm not used to working with PostgreSQL, but am using Zend_Db_Select to create my queries.
What does the error below mean?
SQL error:
ERROR: schema "il" does not exist
In statement:
SELECT il.count(*) AS "count" FROM "image_lite" AS "il"
INNER JOIN "exif_parse" AS "ex" ON il.image_id = ex.image_id
WHERE (ex.cam_make = 'apple')
I would like to find a way to create and populate a database during asp.net setup.
So, what I'm willing to do is:
Create the database during the setup
Populate the database with some initial data (country codes or something like that)
Create the appropriate connection string in the configuration file
I'm using .NET 3.5 and Visual Studio 2005, and the Database is SQL Server 2005.
Thanks in advance.
There are 3 way for querying against conceptual model in EF :
LINQ to Entity
Entity SQL
Query Builder Methods
Which one is better for which situation? Is there any performance issues for these 3 type of querying?
A cross join performs a cartesian product on the tuples of the two sets.
SELECT *
FROM Table1
CROSS JOIN Table2
Which circumstances render such an SQL operation particularly useful?
In SQL Server, there is the option to use query hints.
eg
SELECT c.ContactID
FROM Person.Contact c
WITH (INDEX(AK_Contact_rowguid))
I am in the process of getting rid of unused indexes and was wondering how I could go about determining if an index was used as a query hint. Does anyone have suggestions on how I could do this?
Cheers,
Joe
Ok, there are a million regexes out there for validating an email address, but how about some basic email validation that can be integrated into a TSQL query for Sql Server 2005?
I don't want to use a CLR procedure or function. Just straight TSQL.
Has anybody tackled this already?
i don't know whats wrong with this sql query.
SELECT *
FROM main
WHERE key LIKE '%$word%'
its giving results in phpMyAdmin but giving warning while executing it in a php page.
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource
I want to create a view for each tree for each customer of this 3 table structured in this way:
Fields: db_attrib.name, db_attrib.name, db_attrib.name until the last db_tree.id_child = 0
Values: db_attrib_values.value where db_attrib.id = db_attrib_value.id_attrib and so on for each child
And so on for each db_tree.id
This is the link to sql fiddle with the prepared structure:
http://sqlfiddle.com/#!9/21516
I need to convert int data table field to nchar or nvarchar leading zeros
example:
1 convert to '001'
867 convert to '000867'
thx.
I tested this T-SQL Script and work fine for me !
DECLARE @number1 INT, @number2 INT
SET @number1 = 1
SET @number2 = 867
SELECT RIGHT('000' + CAST(@number1 AS NVARCHAR(3)), 3 ) AS NUMBER_CONVERTED
SELECT RIGHT('000000' + CAST(@number2 AS NVARCHAR(6)), 6 ) AS NUMBER_CONVERTED
Hello ,
I would like to query from SQL Server 2000 Database.I have got two tables. They are Purchase and PurchaseDetails. I would like to get product records with Last Purchase ID but I can't query with the following statements.So please help me.
SELECT TOP 100 PERCENT dbo.Purchase.PurchaseID AS LastOfPurchaseID, dbo.PurchaseDetails.ProductID,
MAX(dbo.Purchase.PurchaseDate) AS LastOfPurchaseDate
FROM dbo.Purchase INNER JOIN
dbo.PurchaseDetails ON dbo.Purchase.PurchaseID = dbo.PurchaseDetails.PurchaseID
GROUP BY dbo.PurchaseDetails.ProductID, dbo.Purchase.PurchaseDate,dbo.Purchase.PurchaseID
ORDER BY MAX(dbo.Purchase.PurchaseDate) DESC
I was browsing around and found this blog post:
http://erikej.blogspot.com/2010/04/version-3-of-exportsqlce-now-available.html
(It is for a great add in if you user SQL Server CE.)
On that post I saw an screen shot of SSMS with images in the results.
How is this done? I have images in my database (PNG files that are serialized via memory stream), but I just see numbers when I select the image column.
Is there a way in fluent nhibernate (or possibly NHibernate in general) to tell it to generate the primary keys differently? It creates the column name for the key fine, but the index/constraint gets weird generated names like:
PK_Address_3214EC2725332734
PK_CreditCa_3214EC2756CA82C8
etc...
I can use straight sql to rename them but i'd rather not.
thanks,
all
I want to start working on a big project. I research about performance issues about LINQ to EF and NHibernate. I want to use one of them as ORM in my project. now my question is that which one of these two ORM can get me better performance in my project? I will use SQL Server 2008 as database and C# as programming language.
Hi,
I am using Oracle Sql Developer to browse a MySQL database. When I browse table with Columns tab(shows table definitions), some of tables will display an Error Encountered dialog that says: Vendor code 1317. Does anyone know how I can resolve this?
Thanks,
/Z
I'm running SQL Server 2005 Express. And I'm trying to do a bulk insert/import of a data file with a field/row terminator that uses a hexadecimal value 0x001. How should I represent it in a bulk insert command?
I have something like:
bulk insert xxx.dbo.[yyy]
from 'D:\zzz\zzz.dat'
with (
CODEPAGE='RAW',
FIELDTERMINATOR = '=|=',
ROWTERMINATOR = '=|=\001\n',
KEEPNULLS
);
which results in
Msg 4863, Level 16, State 1, Line 7
Bulk load data conversion error (truncation) for row 1, column 3 (code).
The query is a single select containing a lot of grouping levels and aggragate operations.
With SET ARITHABORT ON is takes less than a second, otherwise it takes several minutes. We have seen this behavior on SQL Server 2000 and 2008.
update answers a1
set a1.FilingDate=(
select date_sub( a2.FilingDate
,Interval 1000 Year) as FilingDate
from answers a2
where Year(a2.FilingDate)>=3000
)
where Year(a1.FilingDate)>=3000
but it gives me the following error:
You have an error in your SQL syntax;
check the manual that corresponds to
your MySQL server version for the
right syntax to use near 'update
answers a1 set a1.FilingDate=( select
date_sub(a2.FilingDate,Interval 10' at
line 1
Can anyone tell me about the issue and its solution?
Hibernate criteria, using DB2 dialect, generates the following sql with
composite keys in the IN clause, but DB2 answers that the query is incorrect:
select * from tableA where (x, y) IN ( ( 'x1', y1) )
but, DB2 throws this:
SQL0104N An unexpected token "," was found following ", y) in
( ('x1'".
Expected tokens may include: "+". SQLSTATE=42601
Howdy Folks,
what is the best solution to import large amounts of records into an MySQL or Oracle Database. I Think there are two ways :
Insert every record with an persistent connection
Create on BIG SQL-Statement and query the Database
Iam not sure wich is performing better ? Is there any Best Practice Solutions for this kind of operation ??
In SQL Server 2008, is it possible to create a column that can have a value inserted into it, but can never be updated? In other words, the column can have an initial value inserted into it, but once it contains a non-null value, it can never be changed. If possible, I would prefer to do it without using a trigger.
Thanks - Randy
Given the following models:
class Recipe < ActiveRecord::Base
has_many :recipe_ingredients
has_many :ingredients, :through => :recipe_ingredients
end
class RecipeIngredient < ActiveRecord::Base
belongs_to :recipe
belongs_to :ingredient
end
class Ingredient < ActiveRecord::Base
end
How can I perform the following SQL query using Arel in Rails 3?
SELECT * FROM recipes WHERE NOT EXISTS (
SELECT * FROM ingredients WHERE
name IN ('chocolate', 'cream') AND
NOT EXISTS (
SELECT * FROM recipe_ingredients WHERE
recipe_ingredients.recipe_id = recipes.id AND
recipe_ingredients.ingredient_id = ingredients.id))