sql-server-2005

Error inserting date and time in SQL Server 2005 datetime c#? [closed]

南笙酒味 提交于 2019-12-25 21:03:21
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . Problem saving to SQL Server 2005: cmd = new SqlCommand("INSERT into survey_Request1(sur_no,sur_custname,sur_address,sur_emp,sur_date,sur_time,Sur_status)values(" + "'" + textBox9.Text + "'" + "," + "'" +

Deallocation of SqlDataReader

只愿长相守 提交于 2019-12-25 19:13:14
问题 I have a contractor that wrote code like this all over the place when we execute sql queries: sql.Append(string.Format("SELECT TableId FROM ps_SavedTables WHERE guid = '{0}'", guid)); using (IDataReader reader = SqlHelper.GetDataReader(sql.ToString())) { if (reader.Read()) { result = reader.IsDBNull(0) ? string.Empty : reader[0].ToString(); } //CDW added to close SqlDataReader reader.Close(); } The GetDataReader class was in an App_Code helper file and is declared like so: public static

Deallocation of SqlDataReader

Deadly 提交于 2019-12-25 19:13:02
问题 I have a contractor that wrote code like this all over the place when we execute sql queries: sql.Append(string.Format("SELECT TableId FROM ps_SavedTables WHERE guid = '{0}'", guid)); using (IDataReader reader = SqlHelper.GetDataReader(sql.ToString())) { if (reader.Read()) { result = reader.IsDBNull(0) ? string.Empty : reader[0].ToString(); } //CDW added to close SqlDataReader reader.Close(); } The GetDataReader class was in an App_Code helper file and is declared like so: public static

Deallocation of SqlDataReader

纵然是瞬间 提交于 2019-12-25 19:12:37
问题 I have a contractor that wrote code like this all over the place when we execute sql queries: sql.Append(string.Format("SELECT TableId FROM ps_SavedTables WHERE guid = '{0}'", guid)); using (IDataReader reader = SqlHelper.GetDataReader(sql.ToString())) { if (reader.Read()) { result = reader.IsDBNull(0) ? string.Empty : reader[0].ToString(); } //CDW added to close SqlDataReader reader.Close(); } The GetDataReader class was in an App_Code helper file and is declared like so: public static

Import Xml nodes as Xml column with SSIS

╄→гoц情女王★ 提交于 2019-12-25 16:57:30
问题 I'm trying to use the Xml Source to shred an XML source file however I do not want the entire document shredded into tables. Rather I want to import the xml Nodes into rows of Xml. a simplified example would be to import the document below into a table called "people" with a column called "person" of type "xml". When looking at the XmlSource --- it seem that it suited to shredding the source xml, into multiple records --- not quite what I'm looking for. Any suggestions? <people> <person>

what exactly precision of 15 digits mean for float data type?

眉间皱痕 提交于 2019-12-25 15:54:22
问题 As per the http://msdn.microsoft.com/en-us/library/ms173773.aspx float is approx. data type. But also in the same article it is being mentioned that float has precision of 15 digits. What exactly it mean by Precision of 15 digits ? 回答1: It means that the first 15 digits are approximately correct. Thanks to IEEE 754 there are many numbers that can't be exactly represented, but you can be sure that the first 15 digits are very close. 回答2: Your numbers are exact with a precision of 15 digits.

where is the problem

冷暖自知 提交于 2019-12-25 15:52:38
问题 I new transact sql i'm stock with this CREATE PROCEDURE Example @MAESTRDESC varchar(50) --Contiene el valor a ingresar por pantalla AS /****Vars*****/ DECLARE @Result TABLE ( ClientesDisponibles int, ClientesAgendados int ) DECLARE @SQL varchar(500),--Guarda la cantidad de clientes disponibles @SQLAGENDADOS varchar(500) SET @SQL = 'SELECT COUNT(idtable) from table'; SET @SQL = 'SELECT COUNT(idtable2) from table2'; INSERT INTO @Result EXEC @SQL, EXEC@SQLAGENDADOS; SELECT R.ClientesDisponibles,

SQL Server query error: “Missing or incomplete select statement”

让人想犯罪 __ 提交于 2019-12-25 15:52:31
问题 SELECT Id, Product, [fare] = CASE WHEN @date BETWEEN s1from AND s1to THEN s1rate ELSE fare FROM Table1 Error: Missing or incomplete select statement 回答1: Haven't you forgot the END keyword at the end of CASE statement? Ie. SELECT Id, Product, [fare] = CASE WHEN @date BETWEEN s1from AND s1to THEN s1rate ELSE fare END FROM Table1 回答2: Try SELECT Id, Product, [fare] = CASE @date WHEN BETWEEN s1from AND s1to THEN s1rate ELSE fare END FROM Table1 回答3: The query might be like this, Select Id,

how many joins can a sql query have

↘锁芯ラ 提交于 2019-12-25 14:57:26
问题 How many INNER JOIN s can a query tolerate SELECT table0.person_name, table5.animal_name FROM table1 JOIN table0 ON table1.person_id = table0.person_id JOIN table5 ON table1.animal_id = table5.animal_id WHERE table1.aa = input1 AND table1.bb = input2 AND table1.cc = input3 AND table1.dd = input4 回答1: This msdn link provides all of the relevant statistics. Versions of SQL Server after 2005 don't have a hard limit on number of joins, but instead it is limited by "available resources". For any

Change default dateformat stored in a database

强颜欢笑 提交于 2019-12-25 11:56:23
问题 I am seeeing my dates are stored in database in this format for a column (datetime datatype) 2011-01-14 10:15:41.787 i.e YYYY-MM-DD way . How could I make the default storage in YYYY-DD-MM format . Do I need to set that for all the DBS, or I can set it for single DB and how ? 回答1: I have the column in datetime datatype, right now it is saving as 2011-01-14 10:15:41.787 , my question is how can I set the db to store it as 2011-14-01 10:15:41.787 That is the crux of the confusion. Just because