Got an exception 'datetime2' is not a recognized built-in function name' while running the query as you mentioned.
TarunKumarSusarapu
Posts
-
How to convert total database columns datetime to date in the format of dd-mm-yyyy -
How to convert total database columns datetime to date in the format of dd-mm-yyyyStill getting error 'Conversion failed when converting date and/or time from character string.' while converting by using your query.
-
How to convert total database columns datetime to date in the format of dd-mm-yyyyOk.I can leave it.At least can u please tell me how to convert that field into datetime by using above query.
alter table GL add GL_DATE1 datetime null
update GL set GL_DATE=convert(datetime,getdate(),104)
update GL set GL_DATE1=GL_DATE
alter table GL drop column GL_DATE
SP_RENAME 'GL.GL_DATE1','GL_DATE','column' -
How to convert total database columns datetime to date in the format of dd-mm-yyyyI tried this query in SQL. But getting errors like 'The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.'
declare cur cursor for Select Table_Name From INFORMATION_SCHEMA.COLUMNS Where column_name = 'INV_DATE'
declare @tablename nvarchar(max)
declare @sqlstring nvarchar(max)
open cur
fetch next from cur into @tablename
while @@fetch_status=0
begin
--print @tablenameset @sqlstring = 'update '+@tablename+' SET INV_DATE = CONVERT(varchar(10),INV_DATE,105)'
exec sp_executesql @sqlstring
fetch next from cur into @tablename
endclose cur
deallocate curPlease suggest me a solution
current format:2016-03-31 00:00:00.000
Required Format:31-03-2016
DataType:DateTimeI tried to copy data and changing to DateTime using temp field.But also getting the same error.
alter table GL add GL_DATE1 datetime null
update GL set GL_DATE=convert(datetime,GL_DATE,104)-------->Getting error here
update GL set GL_DATE1=GL_DATE
alter table GL drop column GL_DATE
SP_RENAME 'GL.GL_DATE1','GL_DATE','column'please give me the advice to copy data from one field to another field using the temp table.
Please
-
How to convert total database columns datetime to date in the format of dd-mm-yyyyOk Thank you.I will change the message board. :)
-
How to convert total database columns datetime to date in the format of dd-mm-yyyyI tried to copy data and changing to DateTime using temp field.But also getting the same error.
alter table GL add GL_DATE1 datetime null
update GL set GL_DATE=convert(datetime,GL_DATE,104)-------->Getting error here
update GL set GL_DATE1=GL_DATE
alter table GL drop column GL_DATE
SP_RENAME 'GL.GL_DATE1','GL_DATE','column'please give me the advice to copy data from one field to another field using the temp table.
-
How to convert total database columns datetime to date in the format of dd-mm-yyyyI tried to convert in single table also containing date format in datetime as 2016-03-31 00:00:00.000.
update invINVOICE set INV_DATE =convert(datetime,convert(datetime,INV_DATE ,(105)))
But still got the same error while running the query. I already written script for database to convert all the columns to datetime with a format '2016-03-31 00:00:00.000' Now they want only date format containing dd-mm-yyyy. Please suggest me solution this time.
-
How to convert total database columns datetime to date in the format of dd-mm-yyyyI tried this query in sql.But getting errors like
'The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.'
declare cur cursor for Select Table_Name From INFORMATION_SCHEMA.COLUMNS Where column_name = 'INV_DATE'
declare @tablename nvarchar(max)
declare @sqlstring nvarchar(max)
open cur
fetch next from cur into @tablename
while @@fetch_status=0
begin
--print @tablenameset [@sqlstring](https://www.codeproject.com/Members/sqlstring) = 'update '+@tablename+' SET INV\_DATE = CONVERT(varchar(10),INV\_DATE,105)' exec sp\_executesql [@sqlstring](https://www.codeproject.com/Members/sqlstring) fetch next from cur into @tablename end
close cur
deallocate curPlease suggest me a solution current format:2016-03-31 00:00:00.000 Required Format:31-03-2016 DataType:DateTime
-
How to save values in table in SQL without crashing when it is used by multiple usersThank you Mr.palikhelsanjeeb.I will go through this link and let you know the result if it is useful. :)
-
How to save values in table in SQL without crashing when it is used by multiple usersI tried all the points as you mentioned here.But still, invoice number clash happens when the multiple users save at a time.Here the invoice number is unique.But in details part we can save multiple products for a particular invoice.But here clash happens when multiple users enter data at once. for example
users-->invoice no Products
Raj 1 J,K
Tarun 2 O,MBut at the time of saving it swapped like this
users-->invoice no Products
Raj 1 J,K,M-------->Clashing taken place
Tarun 2 OPlease give me suggestions to solve this.
-
How to save values in table in SQL without crashing when it is used by multiple usersI tried all the points as you mentioned here.But still, invoice number clash happens when the multiple users save at a time.Here the invoice number is unique.But in details part we can save multiple products for a particular invoice.But here clash happens when multiple users enter data at once. for example
users-->invoice no Products
Raj 1 J,K
Tarun 2 O,MBut at the time of saving it swapped like this
users-->invoice no Products
Raj 1 J,K,M-------->Clashing taken place
Tarun 2 OPlease give me suggestions to solve this.
-
How to save values in table in SQL without crashing when it is used by multiple usersHere Passing a query as a parameter to get_data method.How can we use parameters here?
public string get_data(string sqlstr)
{
string strTemp = "";
try
{
double sum = 0;
if (cn.State != ConnectionState.Open) cn.Open();
TRcmd2.Connection = cn;
TRcmd2.CommandText = sqlstr;
TRdr = TRcmd2.ExecuteReader();
if (TRdr.Read())
strTemp = TRdr.GetValue(0).ToString();
TRdr.Close();
}
catch
{
try
{
if (!TRdr.IsClosed == true) TRdr.Close();
}
catch (Exception EX) { }
}
return (strTemp);
} -
How to save values in table in SQL without crashing when it is used by multiple usersThank you Mr.Gerry.These may be one of the reasons of data crashing.Can u please explain the point 3 briefly and give me ways to write short code for that.
-
How to save values in table in SQL without crashing when it is used by multiple usersThank you Mr.Ricard.These may be one of the reasons of data crashing.I will try to do modifications at my side and let you know the concerns about this.
-
How to save values in table in SQL without crashing when it is used by multiple usersThank you Simon for your document shared.I will go through it and let you know the result.
-
How to save values in table in SQL without crashing when it is used by multiple usersThank you Mr.Simon_Whale.Can u please explain it briefly.What is the use of it?
-
How to save values in table in SQL without crashing when it is used by multiple usersThank you Mr.Afzaal.I have also even tried stored procedures and Parameterised queries.But when the huge amount of data has been taken place then this problem appear at my side.So can u please explain the concept of concurrency and locking the thread.I have already used threading in my project.At customer side when multiple users are creating transactions at the single time, crashing occurred.
-
How to save values in table in SQL without crashing when it is used by multiple usersHow to save values in SQL in two different columns in a table without crashing of the values in a network.
Ex: There are 20 users in my network.All wants to update one particular row at a time.
Here the crashing has been taken place.That means suppose I have taken one table in that many columns there.The user wants to update two columns a,b with their values at a time. when we click on update sometimes it swaps the data.a=10,
b=20 i want to updatebut it updated like this a=20,b=10
sometimes it has been taken null value also.
Why does it happen?If you explain how to solve this problem.It would be appreciated.
I have written this code in c# to save.But while users saving at a time one row.The swapping of column values saving taken place.
sqlstr = "Insert into invINVOICEDETAILS (comment_NAME30, PRODUCT_NO, PRODUCT_NAME, QTY, UOM, PRICE, ITEM1_NO, DISCOUNT_PC, AMOUNT, SC_NO, GL_CODE, PROJ_NO, Gp_NO, WH_NO, Sales_exempt,FACTOR," +
"Category, IMPORTED_FROM_NO, IMPORTED_FROM, GST_Amt, DISCOUNT_PC_2,Ref_No, GL_DESC, PRODUCT_NAME_LONG, CREATED_BY," +
"DATE_CREATED, Deleted, INV_NO,Transfer, TICK, ID, AC_NO, AC_NAME, ITEM10, invNo_user, AVERAGE_COST, LP_COST, STD_COST,QTY_UNFILLED,DATETIME,Batch_No," +
"Expiry_Date,PRINT_ITEM,QTY_BILLED,ITEM6_NO,ITEM7_NO,ITEM8_NO,IMPORT_KEY) values (@comment_NAME30,@PRODUCT_NO,@PRODUCT_NAME,@QTY,@UOM,@PRICE," +
"@ITEM1_NO,@DISCOUNT_PC,@AMOUNT,@SC_NO,@GL_CODE,@PROJ_NO,@Gp_NO," +
"@WH_NO,@Sales_exempt,@FACTOR,@Category,@IMPORTED_FROM_NO," +
"@IMPORTED_FROM,@GST_Amt,@DISCOUNT_PC_2,@Ref_No,@GL_DESC," +
"@PRODUCT_NAME_LONG, @CREATED_BY, @DATE_CREATED, @Deleted, @INV_NO," +
"@Transfer,@TICK,@ID,@AC_NO,@AC_NAME,@ITEM10,@invNo_user,@AVERAGE_COST," +
"@LP_COST,@STD_COST,@QTY_UNFILLED,@DATETIME,@Batch_No,@Expiry_Date," +
"@PRINT_ITEM, @QTY_BILLED,@ITEM6_NO,@ITEM7_NO,@ITEM8_NO,@IMPORT_KEY)";// cfs.Audit\_Log("Invoice", ddl\_Inv.Text, txt\_Custcode.Text, strpcode, strUom, Prodqty, true, false, false); //sqlstr = "insert into invINVOICEDETAILS (" + sfield + ") values (" + sdata + ")"; //sqlstr = "insert into invINVOICEDE
-
How to do CRUD Operations in Windows Applications Using Entity FrameWorkHai
This is Tarun
I want to do CRUD Operations in Windows Forms Using Entity Framework.
Would you please tell me how to do this.
I already tried this article <a href="http://www.codeproject.com/Articles/221931/Entity-Framework-in-WinForms">Entity Framework in WinForms</a>[<a href="http://www.codeproject.com/Articles/221931/Entity-Framework-in-WinForms" target="_blank" title="New Window">^</a>] But Here It did n't enable entitydatasource control in this.
Kindly Reply me