sql-server-2008-r2

golang SQL Server query via go-mssqldb

只谈情不闲聊 提交于 2020-02-04 09:45:06
问题 I'm trying to query SQL Server 2008 R2 using go https://github.com/denisenkom/go-mssqldb. The SQL Server 2008 R2 instance is on a VM under Windows Server 2008 R2; I'm doing the development under the Win 7 VMWare host and running the program from there to query the DB on the VM. The DB has been up and running an app hosted on the server VM. Code is below. The error I'm getting is : [EDIT 2017-03-14 : new error when I specify port] Login error: read tcp 192.168.91.1:15222->192.168.91.135:1433:

How to copy data in identity column?

北城以北 提交于 2020-02-03 08:51:13
问题 I have a table with an identity column in a server and have a other table with same structure in another server.. Now I want to copy all data from one table to other table but I can't help it... I have already created a linked server.. I use this: insert into [server].[database].[dbo].[table1] select * from table2 I also use this query without identity column in the place of * insert into [server].[database].[dbo].[table1] select column1, column2 from table2 What should I do ? 回答1: If you

How to copy data in identity column?

本小妞迷上赌 提交于 2020-02-03 08:51:05
问题 I have a table with an identity column in a server and have a other table with same structure in another server.. Now I want to copy all data from one table to other table but I can't help it... I have already created a linked server.. I use this: insert into [server].[database].[dbo].[table1] select * from table2 I also use this query without identity column in the place of * insert into [server].[database].[dbo].[table1] select column1, column2 from table2 What should I do ? 回答1: If you

Reproducible CFQUERYPARAM performance issue in Coldfusion 10

 ̄綄美尐妖づ 提交于 2020-02-03 04:55:21
问题 I've consistently been able to reproduce a serious parameterization performance issue with Coldfusion 10 querying SQL Server 2008 R2 and would be interested to know what others get. The code is below. What does the test do? It creates a table with 100 rows. A data column is blank in all but one. It then runs a Coldfusion query 10 times, half using cfqueryparam and half using a simple string. It returns a list with the response time for each. When I run this, apart from the initial calls, the

SQL Server xp_delete_file parameters

假装没事ソ 提交于 2020-01-31 23:00:23
问题 Who can explain list of xp_Delete_file parameters in sql server. I don't find msdn document for this stored procedure. I got script of xp_Delete_file from maintenance plan but didn't understand first parameter. 回答1: Xp_delete_file take five parameters: File Type = 0 for backup files or 1 for report files. Folder Path = The folder to delete files. The path must end with a backslash "\". File Extension = This could be 'BAK' or 'TRN' or whatever you normally use. Date = The cutoff date for what

SQL Server xp_delete_file parameters

人盡茶涼 提交于 2020-01-31 22:59:27
问题 Who can explain list of xp_Delete_file parameters in sql server. I don't find msdn document for this stored procedure. I got script of xp_Delete_file from maintenance plan but didn't understand first parameter. 回答1: Xp_delete_file take five parameters: File Type = 0 for backup files or 1 for report files. Folder Path = The folder to delete files. The path must end with a backslash "\". File Extension = This could be 'BAK' or 'TRN' or whatever you normally use. Date = The cutoff date for what

Getting error in SQL query with function use

北城余情 提交于 2020-01-29 17:55:39
问题 When I run this query through C# adapter it is causing an error: Incorrect syntax near Use Any ideas? When I run this in SQL Server 2008 R2 it's working fine. create FUNCTION [dbo].[fn_Split] (@sep nvarchar(10), @s nvarchar(4000)) RETURNS table AS RETURN ( WITH Pieces(pn, start, stop) AS ( SELECT 1, 1, CHARINDEX(@sep, @s) UNION ALL SELECT pn + 1, stop + (datalength(@sep)/2), CHARINDEX(@sep, @s, stop + (datalength(@sep)/2)) FROM Pieces WHERE stop > 0 ) SELECT pn, SUBSTRING(@s, start, CASE WHEN

Getting error in SQL query with function use

南笙酒味 提交于 2020-01-29 17:55:27
问题 When I run this query through C# adapter it is causing an error: Incorrect syntax near Use Any ideas? When I run this in SQL Server 2008 R2 it's working fine. create FUNCTION [dbo].[fn_Split] (@sep nvarchar(10), @s nvarchar(4000)) RETURNS table AS RETURN ( WITH Pieces(pn, start, stop) AS ( SELECT 1, 1, CHARINDEX(@sep, @s) UNION ALL SELECT pn + 1, stop + (datalength(@sep)/2), CHARINDEX(@sep, @s, stop + (datalength(@sep)/2)) FROM Pieces WHERE stop > 0 ) SELECT pn, SUBSTRING(@s, start, CASE WHEN

Getting error in SQL query with function use

不想你离开。 提交于 2020-01-29 17:55:25
问题 When I run this query through C# adapter it is causing an error: Incorrect syntax near Use Any ideas? When I run this in SQL Server 2008 R2 it's working fine. create FUNCTION [dbo].[fn_Split] (@sep nvarchar(10), @s nvarchar(4000)) RETURNS table AS RETURN ( WITH Pieces(pn, start, stop) AS ( SELECT 1, 1, CHARINDEX(@sep, @s) UNION ALL SELECT pn + 1, stop + (datalength(@sep)/2), CHARINDEX(@sep, @s, stop + (datalength(@sep)/2)) FROM Pieces WHERE stop > 0 ) SELECT pn, SUBSTRING(@s, start, CASE WHEN

How to run the same query on all the databases on an instance?

不羁的心 提交于 2020-01-26 09:44:27
问题 I have (for testing purposes) many dbs with the same schema (=same tables and columns basically) on a sql server 2008 r2 instance. i would like a query like SELECT COUNT(*) FROM CUSTOMERS on all DBs on the instance. I would like to have as result 2 columns: 1 - the DB Name 2 - the value of COUNT(*) Example: DBName // COUNT (*) TestDB1 // 4 MyDB // 5 etc... Note: i assume that CUSTOMERS table exists in all dbs (except master ). 回答1: Try this one - SET NOCOUNT ON; IF OBJECT_ID (N'tempdb.dbo.