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!
I was wondering if there are any free / open source alternatives to RedGate's Data Generator. I do not care if the tool is script based, GUI based, written in anly language/platform. I should be able to target a SQL Server or MySQL schema and have test data generated for me which gets inserted into db directly or generate scripts for insertion.
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 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.
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')
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?
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
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?
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
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 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.
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.
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).
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
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
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.
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
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
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
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?
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 ??
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
I am trying to get my linq query to replicate my t-sql but I am lost.
SELECT *
FROM BaiDetail INNER JOIN
BaiDetailMap ON BaiDetail.DetailText
LIKE '%' + BaiDetailMap.BaiDetailMapSearchText +'%'
This is what I have so far... but no go
from det in Source
from map in Map
where det.DetailText.Contains(map.SearchText)
select new {det, map}
Error Message:
Only arguments that can be evaluated on the client are supported for the String.Contains method.
Hi,
We are working on a Windows Mobile 6.5 application.
The application is already installed in some devices, and we need to distribute a new version with changes in the database schema (we added a few tables).
Is there a way to make a "patch" windows mobile installer that will replace the application and update the embedded SQL database with some scripts?
In a normal windows installer we would create a custom action in the installation process to apply the changes in the database, but I'm not sure how to do that for Windows Mobile
Thanks.