sql-server-2005

SQL Server View showing outdated / wrong data after changing underlying dependencies

烂漫一生 提交于 2021-01-27 03:56:10
问题 We have a View (call it X) that is the base view called by 2 other views(call them Y and Z). Today we made a change to view X, after that view Y and Z started bringing back data that was incorrect. When we were in Management Studio and ran SELECT * FROM Y (which is exactly how the view is called in code) it would get back data that was incorrect. However, when we ran the actual SQL that the view contained it was fine. We tried a number of things until a colleague suggested adding a space to

Query cost relative to batch is 100%

℡╲_俬逩灬. 提交于 2021-01-26 03:13:36
问题 I'm not sure sure how to interpret this, but all the queries I run in sql server 2005 have a "query cost (relative to batch)" of 100%. Is there any way to reduce the cost? 回答1: If your batch (what you are executing within a given call) has one query then relative to that batch that query takes up 100% as it is the only query within that batch. I.e.: BEGIN SELECT * FROM table -- Will be 100% of batch END BEGIN SELECT * FROM table -- Will be 50% of batch SELECT * FROM table -- Will be 50% of

How to choose returned column name in a SELECT FOR XML query?

*爱你&永不变心* 提交于 2021-01-20 18:44:27
问题 MS SQL has a convenient workaround for concatenating a column value from multiple rows into one value: SELECT col1 FROM table1 WHERE col2 = 'x' ORDER by col3 FOR XML path('') and that returns a nice recordset: XML_F52E2B61-18A1-11d1-B105-00805F49916B ---------------------------------------- <col1>Foo</col1><col1>Bar</col1> only the column name in the returned recordset is rather nasty! The column name seems to include random elements (or a GUID), and hence I am reluctant to use it in my

pyodbc connection to MSSQL 2005 server via IIS7

安稳与你 提交于 2020-12-23 12:12:04
问题 I have IIS7 installed and configured on my laptop and with a python cgi interface. I can run the python script from within Eclipse and get the results I am looking for from the database. But when I run the script from the webpage I get an authentication error. It seems that the connection string is not passing the credentials to the SQL server. Any thoughts? import pyodbc import cgi import cgitb; cgitb.enable() cnxn = pyodbc.connect(driver='{SQL Server}', server='SERVER\INSTANCE', Trusted

pyodbc connection to MSSQL 2005 server via IIS7

孤街浪徒 提交于 2020-12-23 11:41:30
问题 I have IIS7 installed and configured on my laptop and with a python cgi interface. I can run the python script from within Eclipse and get the results I am looking for from the database. But when I run the script from the webpage I get an authentication error. It seems that the connection string is not passing the credentials to the SQL server. Any thoughts? import pyodbc import cgi import cgitb; cgitb.enable() cnxn = pyodbc.connect(driver='{SQL Server}', server='SERVER\INSTANCE', Trusted

pyodbc connection to MSSQL 2005 server via IIS7

你说的曾经没有我的故事 提交于 2020-12-23 11:37:27
问题 I have IIS7 installed and configured on my laptop and with a python cgi interface. I can run the python script from within Eclipse and get the results I am looking for from the database. But when I run the script from the webpage I get an authentication error. It seems that the connection string is not passing the credentials to the SQL server. Any thoughts? import pyodbc import cgi import cgitb; cgitb.enable() cnxn = pyodbc.connect(driver='{SQL Server}', server='SERVER\INSTANCE', Trusted

SQL Server 2005 : map Transaction_ID to @@SPID

送分小仙女□ 提交于 2020-12-12 03:46:05
问题 Is there anyway to map transaction_id from somewhere like sys.dm_tran_active_transactions to an SPID in SQL Server 2005? 回答1: It may sound obvious, but the first two columns documented for sys.dm_tran_session_transactions are session_id and transaction_id . This is the table that maps between transactions and sessions. 来源: https://stackoverflow.com/questions/12703549/sql-server-2005-map-transaction-id-to-spid

How to copy and paste script text from SSMS to Outlook or Word without garbling it?

删除回忆录丶 提交于 2020-12-06 13:28:05
问题 Say, I have a script nicely formatted in SSMS and it's annotated with all kinds of comments in different languages. But when I copy and paste this nice thingy into Word with syntax highlighted I will get a syntax-highlighted message with those comments garbled, as if reading the source text with one code page and pasting it using another code page. Very nasty kinda bug. Does anyone know how to solve this issue once and for all? Thank you! [Update] [Solution] Save → Save with Encoding... →

How to copy and paste script text from SSMS to Outlook or Word without garbling it?

馋奶兔 提交于 2020-12-06 13:25:32
问题 Say, I have a script nicely formatted in SSMS and it's annotated with all kinds of comments in different languages. But when I copy and paste this nice thingy into Word with syntax highlighted I will get a syntax-highlighted message with those comments garbled, as if reading the source text with one code page and pasting it using another code page. Very nasty kinda bug. Does anyone know how to solve this issue once and for all? Thank you! [Update] [Solution] Save → Save with Encoding... →

Is there a way to escape a double quote within a text qualified string on a SSIS Csv import?

徘徊边缘 提交于 2020-12-05 03:20:48
问题 I have a CSV I'm trying to import into SQL using SSIS packages through code. A line might look something like this 321,1234,"SOME MACHINE, MACHINE ACCESSORIES 1 1/2"" - 4""" In this example they're using a double quote to symbolize inches. They are trying to escape the inches double quote with a double quote. SSIS, however, does not honour this escapism and fails. Is there anyway I can still use the double quote symbol for inches and escape it within the quoted text? Many suggestions are to