I have a database (Sql Server 2005) where there are dozens of tables, each of which has a number of columns (on average 10-20) with datatype set to nvarchar(max). This is absolutely killing …
Retrieving the last record in each group – MySQL
There is a table messages that contains data as shown below: Id Name Other_Columns ————————- 1 A A_data_1 2 A A_data_2 3 A A_data_3 4 B …
SQL as Control Source for Access Form field
Is there any way populate an Access Form’s text feild’s value using SQL? I have read that it is not possible to simply enter SQL as the Control Source. Is this true? thanks for any halp 🙂 –edit– I need to perform this query; Answer Pretty sure that is true SQL, but you could use the function: =DLookUp(“field_name”,”table_name”,”any_fieldname = ‘value'”)
Should SQL ranking functionality be considered as “use with caution”
This question originates from a discussion on whether to use SQL ranking functionality or not in a particular case. Any common RDBMS includes some ranking functionality, i.e. its query language has elements like TOP n … ORDER BY key, ROW_NUMBER() OVER (ORDER BY key), or ORDER BY key LIMIT n (overview). They do a great job in increasing performance if
How can I use a PostgreSQL triggers to store changes (SQL statements and row changes)
Using PostgreSQL triggers, is it possible to record the changes that have happened to a table due to INSERT or UPDATE SQL statements and log them to a file for later execution. This is only to be used temporally so just something quick and dirty would do. Answer example of an audit trigger from https://www.postgresql.org/docs/current/static/plpgsql-trigger.html
How can I do an UPDATE statement with JOIN in SQL Server?
I need to update this table in SQL Server with data from its ‘parent’ table, see below: Table: sale Table: ud sale.assid contains the correct value to update ud.assid. What query will do this? I’m thinking of a join but I’m not sure if it’s possible. Answer Syntax strictly depends on which SQL DBMS you’re using. Here are some ways
Export all MS Access SQL queries to text files
I have to document an MS Access database with many many macros queries, etc. I wish to use code to extract each SQL query to a file which is named the same as the query, eg if a query is named q_warehouse_issues then i wish to extract the SQL to a file named q_warehouse_issues.sql I DO NOT WISH TO EXPORT
SP taking 15 minutes, but the same query when executed returns results in 1-2 minutes
So basically I have this relatively long stored procedure. The basic execution flow is that it SELECTS INTO some data into temp tables declared with he # sign and then runs a cursor through these tables a generate a ‘running total’ into a third temp table which is created using CREATE. Then this resulting temp table is joined with other
How should I pass a table name into a stored proc?
I just ran into a strange thing…there is some code on our site that is taking a giant SQL statement, modifying it in code by doing some search and replace based on some user values, and then passing …
Netezza SQL syntax to convert numeric YYYYMMDD format into date
We have a Netezza table that contains dates stored in a numeric YYYYMMDD format (eg 20090731). What is the best Netezza syntax to use to convert this into date format? eg SELECT somefunction(…