column default value or including in insert script?
which is better, is there any performance difference? setting datetime column's default value to getdate() or using getdate() with the insert t-sql script. ...
which is better, is there any performance difference? setting datetime column's default value to getdate() or using getdate() with the insert t-sql script. ...
A bit of background: I have a staging table without constraints which gets data for a given day, then some subsequent code that merges that data into a table with a key on it. I can get rid of perfect duplicates easily using this handy piece of code: delete from tbstage where rowid in ( select rowid from tbstage minus sel...
Am storing a table name in a String ugad = "INSERT INTO tb(Ugname,Ugdob,Uggender)" this is the ordinary query which functions well. But i need to store a Tablename in a string called "dept" and this string will have diff table name at diff times. How should i run it, Wat query should I Give. ugad = "INSERT INTO dept(Ugname,Ugdob,Ugg...
Hi Folks, I am running the simple query below select '''' + event_number + '''' +',' as Event_N from mytable which gives: Event_N --------------- 'BAB0910000001', 'CDD0910000002', 'ODB0910000002', 'YDB0910000003', 'NYC0910000004', Question 1: Is there a way in SQL that can show the result as: Event_N 'BAB0910000001','CDD091000...
From C# with EF, I call a long stored procedure with ExecuteStoreCommand 30 sec after the procedure starts, I have a timeout exception. How can I configure timeout ? On the server or in my C# client ? Thanks ...
Hi, The table aggregate_monthly_conversations consists of columns user_A, user_B, user_B_location and the table monthly_statistics consists only of user_A AND user_B I would like to add the column user_B_location to table monthly_statistics and fill it with appropriate values. To get appropriate values user_B_location for user_B in ta...
Solution 1 : foreach (var item in itemList) { myContext.ExecuteStoreCommand("EXEC MyProc {0};", item); // Insertion } or Solution 2 : StringBuilder sb = new StringBuilder(); foreach (var item in itemList) { sb.AppendLine(String.Format("EXEC MyProc {0};", item)); // Insertion } myContext.ExecuteStoreCommand(sb.ToString()); ...
When I attempt this query: $query = "SELECT * FROM user_objects WHERE object_type = 'TABLE'"; ... I get an empty result set. I have error_reporting() set to E_ALL, so I would assume that if it wasn't connecting correctly, I would be getting an error... right? I'm using a class given to me by a higher-up that they use for everything,...
I have multiple views fueling entity framework, and some of the views don't return all the fields as their brethren. for EF's sake, i need to ensure that all views return the same signature. So in the views that have less fields, i simply add missing columns: ,Column1 ,Column2 ,null Column3 since Column3 is not in the table returne...
Hi, I try to bulk insert some datetime values in this format: 31/12/2005 00:00:00 using something like this: create table Seed ( StartDate datetime not null ) BULK INSERT Seed FROM 'd:\dump\Seed.txt' WITH ( firstrow=2, FIELDTERMINATOR = '\t', ROWTERMINATOR = '\n' ) But I get this: Bulk load data conversion erro...
Hi All, I right click on my table in ssms 2008 and select Script Table as / Drop and Create Table to new window and I try to run the script but get an error: Could not drop table because it is referenced by a foreign key constraint What was the point of the Drop and Create generate script then? Thanks, rod. ...
I'm using a numbers matching table, from one upwards. However, I realize I need to start at zero instead. Can't figure it out.. CREATE TABLE IF NOT EXISTS util_nums (n integer primary key autoincrement not null); insert into util_nums(n) select null from (select 0 as n union select 1 union select 2 union select 3 union select 4 u...
Hello, I have problem with this query, complexity of this query is not good, i use this query from long time and now this database have many rows to get selecting by this method. All index'es is added propertly. I searching some other method to optimize this query by date comparsion because this is bottleneck in this solution. SELECT (...
Hello, I have a postgres database with several million rows, which drives a web app. The data is static: users don't write to it. I would like to be able to offer users query-able aggregates (e.g. the sum of all rows with a certain foreign key value), but the size of the database now means it takes 10-15 minutes to calculate such agg...
Hi All, I wanted to know if in SQL Server there is an equivalent to the Oracle INSTR function? I know that there is CHARINDEX and PATINDEX, but with the oracle version I can also specify the Nth appearance of the character(s) I am looking for. Oracle INSTR: instr( string1, string2 [, start_position [, nth_appearance ] ] ) The CHARINDE...
I think the above isolation levels are so alike. Could someone please describe with some nice examples what the main difference is ? ...
Suppose we have one table in Microsoft Access: ID | Data I need to select one row with a SQL query in VBA code. In what variable to store that row? How to write that row back to the table in VBA? Could you please write simple code? ...
I need to add some common details in more than two tables. ugad = "INSERT INTO Ugadmissiontable(Ugname,Ugdob,Uggender) this adds the info to Ugadmissiontable And i need to add the some of the datas into department details ugad = "INSERT INTO" & dept & "(Ugname,Ugdob,Uggender,Ugage,Ugdept,Ugcoursejoined)" So i ha...
Easier to describe by showing a simplified view of the existing data structure and the desired result... CURRENTLY... Element Response ElementType ElementNumber EntryVal.1 1234.56 EntryVal 1 EntryDes.1 'Current Value' EntryDes 1 EntryVal.2 4321.0 EntryVal 2 En...
Hi everyone I have a set of results - SELECT id FROM recruit_index WHERE YEAR NOT LIKE '2011' I need to update another table column based on each of the above ids using mysql only. Could anyone point me in the right direction? Thanks in advance Mike ...