I have the following SQL statement that list all the columns of a table, and for some reason it ignores the last 2 lines of the where clause: AND t.name =’table1′ AND s.name = ‘dba’ What am I doing wrong? This is the complete SQL code: SELECT DB_Name() AS DatabaseName ,s.[name] AS SchemaName ,t.[name] AS […]
I need to run a variable amount of insert statements. Is it best to run through a loop and execute the query one at a time? Or, is there a way to send all the inserts in one go?
I was curious if the sections of an SQL statement are given names. Like you can have nouns, pronounds, predicates, etc. in the english language For instance, how would each section be identified? SELECT ID, PDATE, PDESC <— Query Type? FROM TABLE_X <— Predicate? WHERE ID=4 <— Criteria? ORDER BY ID DESC <— ??? Thanks
Time is visible on my table as follows 2017-09-15 16:30:00.000 And my Query is like this Format(SlotStartTime,’dd/MM/yyyy hh:mi:ss’) as SlotStartTime And this returns time like this 15/09/2017 04:30:00 So the calculation gets wrong it should be 15/09/2017 04:30:00 PM or stay as it is in 24-hour format. How can I achieve this?
suppose i have the following table CREATE TABLE #ResultTable (NettAmount money, GrossAmount money,TotalVat money) Given a gross amount eg=250 I know that vat is at 17.5% How Do i calculate the totalVat? Thanks for any suggestions
I have a table in my SQL Server database that stores a UserID, the name of a medical condition, and a diagnosis date for that medical condition. UserID ConditionName DiagnosisDate 9038 Hypertension 1971-07-14 9039 Diabetes 1964-05-13 Each user can have multiple medical conditions (i.e. a user with UserID 9038 can have headaches, diabetes, and hypertension). […]
Because I’m using a shared Microsoft SQL Server instance, I have started to use MongoDB as it’s faster to have around 10 inserts per second. At the end of the day, I need to read from the MongoDB (MongoHQ) and insert all data into the shared SQL Server instance (hosting provider). Currently I’m doing this […]
I have member table member_Id Last name first name postcode reference another table memberstomships member_Id membertomship_lastdate membertomship_paymentmethod column with values money member_id membershipstatusid membershipoptionid another table membershipstatustype table membershipstatusid memberstatustype_name another table membershiptype membershiptype_id membershiptype_name another table membershipoption membershiptype_id membershipoptionid I want to get the lastname and firstname and memberstatustype_name and membershiptype_name and membertomship_lastdate for […]
I have a query: select Product.TblProducts.Product_ID, Product.TblProducts.Product_Name, Product.TblProducts.Country from Product.TblProducts WHERE (Product.TblProducts.Domain = ‘mysite.co.uk’) Problem: I want all the products to show, but I want to show products with Country = “United Kingdom” to take high priority and show at top since the domain is UK. I need a sort mechanism to do this. Help […]
When you register an assembly in SQL Server using CREATE ASSEMBLY – where does SQL Server store it? e.g. the following statement registers an assembly with SQL SERVER but I want to know where this is stored by SQL SERVER CREATE ASSEMBLY [YaddyYaddy] FROM ‘C:\YaddyYaddy.dll’ WITH PERMISSION_SET = UNSAFE; GO