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
Tag: tsql
SQL Server table creation date query
How can I get the table creation date of a MS SQL table using a SQL query? I could not see any table physically but I can query that particular table. Answer For 2005 up, you can use I think for 2000, you need to have enabled auditing.
Column name or number of supplied values does not match table definition
In SQL server, I am trying to insert values from one table to another by using the below query: delete from tblTable1 insert into tblTable1 select * from tblTable1_Link I am getting the following …
T-Sql 2005 Adding hours to a datetime field with the result within working hours
I have two Datetime fields that I wish to add together. They are in the following format: ’01/01/1900 00:00:00′. The main issue with this is that I want the calculation to only include working hours. …
How can I get column names from a table in SQL Server?
I want to query the name of all columns of a table. I found how to do this in: Oracle MySQL PostgreSQL But I also need to know: how can this be done in Microsoft SQL Server (2008 in my case)?
Best way to determine Server Product version and execute SQL accordingly?
This is a two-pronged question: Scenario: I have a script to query MSDB and get me details of job schedules. Obviously, the tables differ from SQL 2000 to SQL 2005. Hence, I want to check the version running on the box and query accordingly. Now the questions: Question 1: This is what I am doing. Is there a better way
Delete duplicate records from a SQL table without a primary key
I have the below table with the below records in it I dont have any primary key in this table .But i have the above records in my table already. I want to remove the duplicate records which has the same value in EmpId and EmpSSN fields. Ex : Emp id 5 How can I frame a query to delete
Use bcp to import csv file to sql 2005 or 2008
I have a csv file and i need to import it to a table in sql 2005 or 2008. The column names and count in the csv are different from the table column names and count. The csv is splitted by a ‘;’ . Example CSV FILEcontents: SQL Person Table Answer I’d create a temporary table, bulk insert the lot,
Passing a varchar full of comma delimited values to a SQL Server IN function
Duplicate of Dynamic SQL Comma Delimited Value Query Parameterized Queries with Like and In I have a SQL Server Stored Procedure where I would like to pass a varchar full of comma delimited values to an IN function. For example: This does not work of course. I get the error: Conversion failed when converting the varchar value ‘1,2,3,5,4,6,7,98,234’ to data
What is the equivalent of ‘go’ in MySQL?
In TSQL I can state: In MySQL I can’t write the same query. What is the correct way to write this query in MySQL? Answer Semicolon at the end of the statement.